利用apache+svn+jenkins+maven 实现java环境的自动化构建和部署(四)(网内首发超详细版)
命令格式:mvn archetype:generate -DgroupId={project-packaging} -DartifactId={project-name} -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=falsecd /data/webapp/mywebapp
mvn archetype:generate -DgroupId=com.myweb -DartifactId=mywebapp -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
#ls 生成一个pom.xml和src目录
pom.xmlsrc
Maven的Web程序目录结构
# cd src
# tree
.
`-- main
|-- resources
`-- webapp
|-- WEB-INF
| `-- web.xml
`-- index.jsp
4 directories, 2 files
执行构建
# mvn install
Scanning for projects...
Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
------------------------------------------------------------------------
Building mywebapp Maven Webapp 1.0-SNAPSHOT
------------------------------------------------------------------------
--- maven-resources-plugin:2.6:resources (default-resources) @ mywebapp ---
Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
Copying 0 resource
--- maven-compiler-plugin:2.5.1:compile (default-compile) @ mywebapp ---
No sources to compile
--- maven-resources-plugin:2.6:testResources (default-testResources) @ mywebapp ---
Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory /data/webapp/mywebapp/src/test/resources
--- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ mywebapp ---
No sources to compile
--- maven-surefire-plugin:2.12.4:test (default-test) @ mywebapp ---
No tests to run.
--- maven-war-plugin:2.2:war (default-war) @ mywebapp ---
Packaging webapp
Assembling webapp in
Processing war project
Copying webapp resources
Webapp assembled in
Building war: /data/webapp/mywebapp/target/mywebapp.war
WEB-INF/web.xml already added, skipping
--- maven-install-plugin:2.4:install (default-install) @ mywebapp ---
Installing /data/webapp/mywebapp/target/mywebapp.war to /root/.m2/repository/com/myweb/mywebapp/1.0-SNAPSHOT/mywebapp-1.0-SNAPSHOT.war
Installing /data/webapp/mywebapp/pom.xml to /root/.m2/repository/com/myweb/mywebapp/1.0-SNAPSHOT/mywebapp-1.0-SNAPSHOT.pom
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.689 s
Finished at: 2014-04-16T17:45:42+08:00
Final Memory: 10M/240M
------------------------------------------------------------------------
生成了一个target的目录
# pwd
/data/webapp/mywebapp/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也生成了一份。
页:
[1]