maven 手动构建项目
在空目录下面:
D:\test>mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.stono -DartifactId=my-app
第一次会下载一些jar包,第二次输出:
[INFO] Scanning for projects...[INFO][INFO] ------------------------------------------------------------------------[INFO] Building Maven Stub Project (No POM) 1[INFO] ------------------------------------------------------------------------[INFO][INFO] >>> maven-archetype-plugin:3.0.1:generate (default-cli) > generate-sources @ standalone-pom >>>[INFO][INFO] <<< maven-archetype-plugin:3.0.1:generate (default-cli) < generate-sources @ standalone-pom <<<[INFO][INFO] --- maven-archetype-plugin:3.0.1:generate (default-cli) @ standalone-pom ---[INFO] Generating project in Batch mode[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)[INFO] ----------------------------------------------------------------------------[INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.0[INFO] ----------------------------------------------------------------------------[INFO] Parameter: basedir, Value: D:\test[INFO] Parameter: package, Value: com.stono[INFO] Parameter: groupId, Value: com.stono[INFO] Parameter: artifactId, Value: my-app1[INFO] Parameter: packageName, Value: com.stono[INFO] Parameter: version, Value: 1.0-SNAPSHOT[INFO] project created from Old (1.x) Archetype in dir: D:\test\my-app1[INFO] ------------------------------------------------------------------------[INFO] BUILD SUCCESS[INFO] ------------------------------------------------------------------------[INFO] Total time: 2.062 s[INFO] Finished at: 2018-03-11T10:00:54+08:00[INFO] Final Memory: 17M/128M[INFO] ------------------------------------------------------------------------
会创建my-app,文件:
D:.| pom.xml|\---src +---main | \---java | \---com | \---stono | App.java | \---test \---java \---com \---stono AppTest.java
pom.xml和App.java文件都中规中矩;
但是pom.xml必须手动修改一下:
4.0.0 com.stono my-app jar 1.0-SNAPSHOT my-app http://maven.apache.org 1.8 1.8 junit junit 3.8.1 test
mvn compile 编译
mvn package 打包
mvn install 安装
mvn clean 删除
mvn clean package -U 强制更新依赖,删除那些updated文件
mvn clean package -o offline编译模式,只使用本地仓库