|
命令格式:mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
cd /data/webapp/mywebapp
mvn archetype:generate -DgroupId=com.myweb -DartifactId=mywebapp -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
#ls 生成一个pom.xml和src目录
pom.xml src
Maven的Web程序目录结构
# cd src
# tree
.
`-- main
|-- resources
`-- webapp
|-- WEB-INF
| `-- web.xml
`-- index.jsp
4 directories, 2 files
执行构建
# mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mywebapp Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mywebapp ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ mywebapp ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mywebapp ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /data/webapp/mywebapp/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ mywebapp ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ mywebapp ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ mywebapp ---
[INFO] Packaging webapp
[INFO] Assembling webapp [mywebapp] in [/data/webapp/mywebapp/target/mywebapp]
[INFO] Processing war project
[INFO] Copying webapp resources [/data/webapp/mywebapp/src/main/webapp]
[INFO] Webapp assembled in [33 msecs]
[INFO] Building war: /data/webapp/mywebapp/target/mywebapp.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ mywebapp ---
[INFO] Installing /data/webapp/mywebapp/target/mywebapp.war to /root/.m2/repository/com/myweb/mywebapp/1.0-SNAPSHOT/mywebapp-1.0-SNAPSHOT.war
[INFO] Installing /data/webapp/mywebapp/pom.xml to /root/.m2/repository/com/myweb/mywebapp/1.0-SNAPSHOT/mywebapp-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.689 s
[INFO] Finished at: 2014-04-16T17:45:42+08:00
[INFO] Final Memory: 10M/240M
[INFO] ------------------------------------------------------------------------
生成了一个target的目录
# pwd
/data/webapp/mywebapp/target
[root@s2 target]# tree
.
|--> |-- maven-archiver
| `-- pom.properties
|-- mywebapp
| |-- META-INF
| |-- WEB-INF
| | |--> | | `-- web.xml
| `-- index.jsp
`-- mywebapp.war
6 directories, 4 files
另外这里/root/.jenkins/jobs/test1/workspace/target/mywebapp.war也生成了一份。
|
|