一 、新建project
二、建立好的工程如下
.iml文件解釋如下
Goal | Description |
---|---|
idea:clean | Removes all existing IDEA files for the project. |
idea:help |
Display help information on maven-idea-plugin. Call
mvn idea:help -Ddetail=true -Dgoal=<goal-name>to display parameter details. |
idea:idea | Goal for generating IDEA files a POM. This plug-in provides the ability to generate project files (.ipr, .iml and .iws files) for IDEA. |
idea:module | Creates the module files (*.iml) for IntelliJ IDEA. |
idea:project | Creates the project file (*.ipr) for IntelliJ IDEA. |
idea:workspace | Creates the workspace file (*.iws) for IntelliJ IDEA. |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>testOne</groupId>
<artifactId>testOne</artifactId>
<version>1.0</version>
</project>
Ø project:pom.xml文件中的頂層元素;
Ø modelVersion:指明POM使用的對象模型的版本。這個值很少改動。
Ø groupId:指明創建項目的組織或者小組的唯一標識。GroupId是項目的關鍵標識,典型的,此標識以組織的完全限定名來定義。比如,org.apache.maven.plugins是所有Maven插件項目指定的groupId。
Ø artifactId:指明此項目產生的主要產品的基本名稱。項目的主要產品通常爲一個JAR文件。第二,象源代碼包通常使用artifactId作爲最後名稱的一部分。典型的產品名稱使用這個格式: <artifactId>- <version>. <extension>(比如:myapp-1.0.jar)。
Ø version:項目產品的版本號。Maven幫助你管理版本,可以經常看到SNAPSHOT這個版本,表明項目處於開發階段。
Ø name:項目的顯示名稱,通常用於maven產生的文檔中。
Ø url:指定項目站點,通常用於maven產生的文檔中。
Ø description:描述此項目,通常用於maven產生的文檔中。
對於一個項目中只有下面的一部分是是我們需要關注的:
<groupId>com.chongshi.test</groupId>
<artifactId>hello</artifactId>
<version>1.0</version>
三、新建一個java類新建一個com.test.model.Hello.java
使用右邊的 maven Project
第一次使用時一定要先使用clean 再使用compile
編譯之後的文件目錄如下,多出一個target文件夾