Maven构建插件在发布期间的执行顺序:prepare
今天,我在准备发布(使用Maven发布插件)时,在Maven 3中观察到一个奇怪的行为。由于描述比较长,我想在描述之前先问一个问题: 如何使用发布插件Maven构建插件在发布期间的执行顺序:prepare,maven,plugins,release,execution,Maven,Plugins,Release,Execution,今天,我在准备发布(使用Maven发布插件)时,在Maven 3中观察到一个奇怪的行为。由于描述比较长,我想在描述之前先问一个问题: 如何使用发布插件 因此,构建叉以正确的顺序执行插件 没有相同插件的多次执行# 并为Mojo获取一个有效的plugin.xml 要发布的工件是Maven插件本身(带有注释的Mojo)。当调用release:prepare目标时,它首先以交互模式启动流程,请求发布的新版本数据。之后,它会派生一个新的流程,对应该发布的项目进行“干净的验证” 如控制台输出所述,调用的
- 因此,构建叉以正确的顺序执行插件
- 没有相同插件的多次执行#
- 并为Mojo获取一个有效的plugin.xml
[INFO] [INFO] --- maven-plugin-plugin:3.2:descriptor (default-descriptor) @ concordion-maven-plugin ---
[INFO] [WARNING] Using platform encoding (Cp1252 actually) to read mojo metadata, i.e. build is platform dependent!
[INFO] [INFO] Applying mojo extractor for language: java-annotations
[INFO] [INFO] Mojo extractor for language: java-annotations found 0 mojo descriptors.
当以正确的方式配置时,插件会失败,因为找不到mojo
如果我将发布插件配置为使用
<preparationGoals>clean compile verify</preparationGoals>
clean编译验证
插件的执行顺序更改为:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>false</fork>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<goals>
<goal>
descriptor
</goal>
</goals>
<phase>prepare-package</phase>
</execution>
</executions>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4</version>
<configuration>
<dryRun>true</dryRun>
<preparationGoals>clean compile verify</preparationGoals>
<goals>deploy</goals>
</configuration>
</plugin>
</plugins>
</build>
org.apache.maven.plugins
maven编译器插件
3
1.7
1.7
真的
真的
假的
org.apache.maven.plugins
maven插件
3.2
描述符
准备包装
真的
org.apache.maven.plugins
maven发布插件
2.4
真的
清理编译验证
部署
为什么要更改maven插件的阶段。使用默认的阶段流程类。此外,为什么将编译和验证用作准备目标,因为编译与验证结合使用没有意义,因为验证包含编译。为什么你需要准备目标?您是否通过mvn安装正确构建插件?看起来你错过了maven插件注释依赖项。您可以显示完整的pom或代码位置吗?