[code]
1.mvn install
运行mvn install命令,Maven会把我们项目的构件安装到本地仓库。
...
[INFO] [install:install]
[INFO] Installing .../simple-1.0-SNAPSHOT.jar to \
~/.m2/repository/org/sonatype/mavenbook/simple/1.0-SNAPSHOT/ \
simple-1.0-SNAPSHOT.jar
就是下载 jar而已
2. 配置jetty容器。。不用下载就可以在jetty容器中运行应用
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugin>
mvn jetty:run
3.
创建一个jar应用
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch04
-DartifactId=simple-weather -DpackageName=org.sonatype.mavenbook
-Dversion=1.0
创建一个web应用
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch05
-DartifactId=simple-webapp -DpackageName=org.sonatype.mavenbook
-DarchetypeArtifactId=
mvn jetty:run -Djetty.port=9999 换端口运行,默认是8080
把jar加入maven库中的本地库
mvn install:install-file -Dfile=/home/wenzhe.zhouwz/person_test/jarfile/ais-bdc-1.0.0.jar -DgroupId=com.alibaba.ais.bdc -DartifactId=ais-bdc -Dversion=1.0.0 -Dpackaging=jar
---------------------------貌似不常用--------------------------------------------
1. mvn help:describe -Dplugin=exec -Dfull
使用help插件的describe 目标可以查看exec插件是干什么的
2.下面是exec插件的使用情况,他用来编译执行java源码
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main
3.
mvn dependency:resolve
使用 Maven Dependency 插件来打印出已解决依赖的列表。
[INFO] [dependency:resolve]
[INFO]
[INFO] The following files have been resolved:
[INFO] com.ibm.icu:icu4j:jar:2.6.1 (scope = compile)
[INFO] commons-collections:commons-collections:jar:3.1 (scope = compile
。。。。。
如果你想知道你项目的整个依赖树,你可以运行 dependency:tree 目标
mvn dependency:tree
[INFO] [dependency:tree]
[INFO] org.sonatype.mavenbook.ch04:simple-weather:jar:1.0
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
。。。。
4.忽略单元测试失败
如果你有失败的单元测试,但你仍然希望产生构建输出,你就必须告诉 Maven 让它忽略测试失败。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
或者:
mvn test -Dmaven.test.failure.ignore=true
跳过单元测试:
mvn install -Dmaven.test.skip=true
省略的地方和上面一样
。。。。。
<configuration>
<skip>true</skip>
</configuration>
。。。。。
[/code]
1.mvn install
运行mvn install命令,Maven会把我们项目的构件安装到本地仓库。
...
[INFO] [install:install]
[INFO] Installing .../simple-1.0-SNAPSHOT.jar to \
~/.m2/repository/org/sonatype/mavenbook/simple/1.0-SNAPSHOT/ \
simple-1.0-SNAPSHOT.jar
就是下载 jar而已
2. 配置jetty容器。。不用下载就可以在jetty容器中运行应用
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugin>
mvn jetty:run
3.
创建一个jar应用
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch04
-DartifactId=simple-weather -DpackageName=org.sonatype.mavenbook
-Dversion=1.0
创建一个web应用
mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch05
-DartifactId=simple-webapp -DpackageName=org.sonatype.mavenbook
-DarchetypeArtifactId=
mvn jetty:run -Djetty.port=9999 换端口运行,默认是8080
把jar加入maven库中的本地库
mvn install:install-file -Dfile=/home/wenzhe.zhouwz/person_test/jarfile/ais-bdc-1.0.0.jar -DgroupId=com.alibaba.ais.bdc -DartifactId=ais-bdc -Dversion=1.0.0 -Dpackaging=jar
---------------------------貌似不常用--------------------------------------------
1. mvn help:describe -Dplugin=exec -Dfull
使用help插件的describe 目标可以查看exec插件是干什么的
2.下面是exec插件的使用情况,他用来编译执行java源码
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main
3.
mvn dependency:resolve
使用 Maven Dependency 插件来打印出已解决依赖的列表。
[INFO] [dependency:resolve]
[INFO]
[INFO] The following files have been resolved:
[INFO] com.ibm.icu:icu4j:jar:2.6.1 (scope = compile)
[INFO] commons-collections:commons-collections:jar:3.1 (scope = compile
。。。。。
如果你想知道你项目的整个依赖树,你可以运行 dependency:tree 目标
mvn dependency:tree
[INFO] [dependency:tree]
[INFO] org.sonatype.mavenbook.ch04:simple-weather:jar:1.0
[INFO] +- log4j:log4j:jar:1.2.14:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
。。。。
4.忽略单元测试失败
如果你有失败的单元测试,但你仍然希望产生构建输出,你就必须告诉 Maven 让它忽略测试失败。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
或者:
mvn test -Dmaven.test.failure.ignore=true
跳过单元测试:
mvn install -Dmaven.test.skip=true
省略的地方和上面一样
。。。。。
<configuration>
<skip>true</skip>
</configuration>
。。。。。
[/code]