Maven 使用经验总结

1. list phase-plugin bindings , either of them will work.

 mvn help:describe  -Dcmd=<phase> -Darguments_to_phase

mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list-phase -Dbuildplan.tasks=<phase>  //this one is preferred.

2. list effective pom

mvn help:effective-pom

2.pom里面定义的 profile会自动继承默认pom的配置,默认pom的配置优先执行,如果某个profile的配置不生效,可以检查下默认的pom配置

3. dependencyManagement, pluginManagement节点中配置的内容可以被child POM 继承,child POM中必须引用对应的plugin或者dependency才能起作用,或者是lifecycle的默认binding。

4. resouces 节点有个功能叫做filter,意思是对定义的resouces中的所有文件进行变量替换,替换的变量可以来自maven命令行,其他文件,或者是settings.xml等等。

5. 取消某个phase-plugin binding, 设置对应id的goal的phase为none,如下所示

<plugin>
	<artifactId>maven-resources-plugin</artifactId>
	<version>2.6</version>
	<executions>
		<execution>
			<id>default-resources</id>
			<phase>none</phase>
		</execution>
	</executions>
</plugin>

6. 可以使用maven-assembly-plugin插件生成一个runnable jar package, 支持复杂的打包方式

7. 可以使用maven-antrun-plugin,exec-maven-plugin 插件执行任意命令,

猜你喜欢

转载自blog.csdn.net/jinlxz/article/details/82219567