努力maven:发布这个项目。看起来像是版本不兼容的问题,但我不知道如何纠正这个问题。我使用的是 Maven 版本 3.1.1。
这是我的 pom.xml (示例)
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>summary</report>
<report>project-team</report>
<report>mailing-list</report>
<report>cim</report>
<report>issue-tracking</report>
<report>scm</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
这是发布期间的 Maven 堆栈跟踪:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project project-common-root: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare: java.lang.AbstractMethodError: org.apache.maven.scm.command.tag.AbstractTagCommand.executeTagCommand(Lorg/apache/maven/scm/provider/ScmProviderRepository;Lorg/apache/maven/scm/ScmFileSet;Ljava/lang/String;Lorg/apache/maven/scm/ScmTagParameters;)Lorg/apache/maven/scm/ScmResult;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-release-plugin:2.3.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/161541/.m2/repository/org/apache/maven/plugins/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.jar
[ERROR] urls[1] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-gitexe/1.1/maven-scm-provider-gitexe-1.1.jar
[ERROR] urls[2] = file:/Users/161541/.m2/repository/regexp/regexp/1.3/regexp-1.3.jar
[ERROR] urls[3] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-git-commons/1.1/maven-scm-provider-git-commons-1.1.jar
[ERROR] urls[4] = file:/Users/161541/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.7/plexus-utils-1.5.7.jar
[ERROR] urls[5] = file:/Users/161541/.m2/repository/org/apache/maven/release/maven-release-manager/2.3.2/maven-release-manager-2.3.2.jar
[ERROR] urls[6] = file:/Users/161541/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[7] = file:/Users/161541/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-6/plexus-interactivity-api-1.0-alpha-6.jar
[ERROR] urls[8] = file:/Users/161541/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[9] = file:/Users/161541/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[10] = file:/Users/161541/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[11] = file:/Users/161541/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[12] = file:/Users/161541/.m2/repository/org/apache/maven/shared/maven-invoker/2.0.9/maven-invoker-2.0.9.jar
[ERROR] urls[13] = file:/Users/161541/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
[ERROR] urls[14] = file:/Users/161541/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[15] = file:/Users/161541/.m2/repository/commons-logging/commons-logging/1.0/commons-logging-1.0.jar
[ERROR] urls[16] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-providers-standard/1.7/maven-scm-providers-standard-1.7.pom
[ERROR] urls[17] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-accurev/1.7/maven-scm-provider-accurev-1.7.jar
[ERROR] urls[18] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-bazaar/1.7/maven-scm-provider-bazaar-1.7.jar
[ERROR] urls[19] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-clearcase/1.7/maven-scm-provider-clearcase-1.7.jar
[ERROR] urls[20] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-cvsexe/1.7/maven-scm-provider-cvsexe-1.7.jar
[ERROR] urls[21] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-cvs-commons/1.7/maven-scm-provider-cvs-commons-1.7.jar
[ERROR] urls[22] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-cvsjava/1.7/maven-scm-provider-cvsjava-1.7.jar
[ERROR] urls[23] = file:/Users/161541/.m2/repository/org/netbeans/lib/cvsclient/20060125/cvsclient-20060125.jar
[ERROR] urls[24] = file:/Users/161541/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar
[ERROR] urls[25] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-hg/1.7/maven-scm-provider-hg-1.7.jar
[ERROR] urls[26] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-perforce/1.7/maven-scm-provider-perforce-1.7.jar
[ERROR] urls[27] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-starteam/1.7/maven-scm-provider-starteam-1.7.jar
[ERROR] urls[28] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-svnexe/1.7/maven-scm-provider-svnexe-1.7.jar
[ERROR] urls[29] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-synergy/1.7/maven-scm-provider-synergy-1.7.jar
[ERROR] urls[30] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-vss/1.7/maven-scm-provider-vss-1.7.jar
[ERROR] urls[31] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-tfs/1.7/maven-scm-provider-tfs-1.7.jar
[ERROR] urls[32] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-integrity/1.7/maven-scm-provider-integrity-1.7.jar
[ERROR] urls[33] = file:/Users/161541/.m2/repository/com/mks/api/mksapi-jar/4.10.9049/mksapi-jar-4.10.9049.jar
[ERROR] urls[34] = file:/Users/161541/.m2/repository/org/codehaus/groovy/groovy-all/1.7.6/groovy-all-1.7.6.jar
[ERROR] urls[35] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-jazz/1.7/maven-scm-provider-jazz-1.7.jar
[ERROR] urls[36] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-manager-plexus/1.7/maven-scm-manager-plexus-1.7.jar
[ERROR] urls[37] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-provider-svn-commons/1.7/maven-scm-provider-svn-commons-1.7.jar
[ERROR] urls[38] = file:/Users/161541/.m2/repository/jaxen/jaxen/1.1-beta-8/jaxen-1.1-beta-8.jar
[ERROR] urls[39] = file:/Users/161541/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar
[ERROR] urls[40] = file:/Users/161541/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[41] = file:/Users/161541/.m2/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar
[ERROR] urls[42] = file:/Users/161541/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[43] = file:/Users/161541/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[44] = file:/Users/161541/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[45] = file:/Users/161541/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[46] = file:/Users/161541/.m2/repository/org/apache/maven/scm/maven-scm-api/1.7/maven-scm-api-1.7.jar
[ERROR] urls[47] = file:/Users/161541/.m2/repository/org/jdom/jdom/1.1/jdom-1.1.jar
已解决 将插件升级到最新版本后,项目仍然无法构建,并出现相同的错误。这实际上是根pom.xml中的一个错误。
事实证明,根源在于 pom.xml 文件之一中存在“< scm >”标签。
删除以下标签允许运行maven release:perform任务:
REMOVED:
<scm>
<tag>itabuy-common-root-2.06</tag>
</scm>
感谢 khmarbaise 和 Robert Scholte 的帮助。
我的解决方案是将
org.apache.maven.scm
插件从 1.9
更新为 2.0.1
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>2.0.1</version>
</dependency>