Open idea, choose to create a new project
Select a good idea to provide maven web project template
Click Next Fill Project Information
Click Next, do not do change here.
Here are the information we installed maven
Click Next to select the directory project
Click Finish to start creating the project, wait until the following interface.
Add src / main / java directory manually, as shown below right main folder NewDirectory
Create a new folder named java
After clicking OK, the new folder on the right-java Make Directory asSources Root
Directly open pom.xml file hello_maven project, and then add the coordinates
When adding the coordinates jar package you can also specify the future scope jar package.
Each maven project will need to define the coordinates of this project, coordinates the identity maven jar package definition, such as: entry program
coordinates defined as follows:
<!--项目名称,定义为组织名+项目名,类似包名-->
<groupId>com.itheima</groupId>
<!-- 模块名称 -->
<artifactId>hello_maven</artifactId>
<!-- 当前项目版本号, snapshot 为快照版本即非正式版本, release 为正式发布版本 -->
<version>0.0.1-SNAPSHOT</version>
<packaging > :打包类型
jar:执行 package 会打成 jar 包
war:执行 package 会打成 war 包
pom :用于 maven 工程的继承,通常父工程设置为 pom
Set jdk compiled version
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
Add in tomcat plug-in
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-compiler-plugin</artifactId>
<version></versionversion>
<configuration>
<port>8080</port>
<path>/</path>
</configuration>
</plugin>
</plugins>
</build>