美文网首页首页投稿(暂停使用,暂停投稿)
Web项目开发系列 之一:使用Intelij IDEA搭建web

Web项目开发系列 之一:使用Intelij IDEA搭建web

作者: with_prototype | 来源:发表于2017-07-16 13:08 被阅读0次

一、 工具准备

1. JDK,下载后安装
2. Intelij IDEA: [官网下载](http://www.jetbrains.com.cn/idea.html), 下载后安装
3. Maven3: [Apache Maven官网](http://maven.apache.org/),下载后安装

二、创建maven工程
1. 创建工程



2. 选择maven项目



3. 定义项目名称

4. 指定maven安装目录,默认位置为~/home/user/.m2目录

5. 定义工程名称,模块名称默认情况下,与工程名称一致。



6. 项目创建成功,开启maven自动导入

IDEA完成项目创建后,目录结构如下:

四、 工程结构调整

创建java目录,设置为编译目录

五、 项目配置
添加maven-resource-plugin,用于将配置文件打包至编译路径


    <plugins>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.5</version>
            <executions>
                <execution>
                    <id>copy-xmls</id>
                    <phase>process-sources</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${basedir}/target/classes</outputDirectory>
                        <resources>
                            <resource>
                                <directory>${basedir}/src/main/java</directory>
                                <includes>
                                    <include>**/*.xml</include>
                                </includes>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

六、 启动应用
1. 添加tomcat,删除原有启动前build,添加maven goal:package


image.png

2. 添加项目发布


image.png
3. 启动成功 image.png

相关文章

网友评论

    本文标题:Web项目开发系列 之一:使用Intelij IDEA搭建web

    本文链接:https://www.haomeiwen.com/subject/fxptkxtx.html