建立web项目
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
建立文档项目
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-site
常用命令
mvn site
mvn test
mvn compile
mvn clean
mvn install
标注目录结构
src/main/java----------------Application/Library sources
src/main/resources-----------Application/Library resources
src/main/filters-------------Resource filter files
src/main/assembly------------Assembly descriptors
src/main/config--------------Configuration files
src/main/webapp--------------Web application sources
src/test/java----------------Test sources
src/test/resources-----------Test resources
src/test/filters-------------Test resource filter files
src/site---------------------Site
LICENSE.txt------------------Project's license
README.txt-------------------Project's readme
scope
compile-缺省值,适用于所有阶段,会随着项目一起发布。
provided-类似compile,期望JDK、容器或使用者会提供这个依赖。如servlet.jar。
runtime-只在运行时使用,如JDBC驱动,适用运行和测试阶段。
test-只在测试时使用,用于编译和运行测试代码。不会随项目发布。
system-类似provided,需要显式提供包含依赖的jar,Maven不会在Repository中查找它。
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
建立文档项目
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-site
常用命令
mvn site
mvn test
mvn compile
mvn clean
mvn install
标注目录结构
src/main/java----------------Application/Library sources
src/main/resources-----------Application/Library resources
src/main/filters-------------Resource filter files
src/main/assembly------------Assembly descriptors
src/main/config--------------Configuration files
src/main/webapp--------------Web application sources
src/test/java----------------Test sources
src/test/resources-----------Test resources
src/test/filters-------------Test resource filter files
src/site---------------------Site
LICENSE.txt------------------Project's license
README.txt-------------------Project's readme
scope
compile-缺省值,适用于所有阶段,会随着项目一起发布。
provided-类似compile,期望JDK、容器或使用者会提供这个依赖。如servlet.jar。
runtime-只在运行时使用,如JDBC驱动,适用运行和测试阶段。
test-只在测试时使用,用于编译和运行测试代码。不会随项目发布。
system-类似provided,需要显式提供包含依赖的jar,Maven不会在Repository中查找它。