当前位置: 首页 > 知识库问答 >
问题:

目标组织的执行默认cli。阿帕奇。专家插件:maven发布插件:2.2.2:准备失败。空指针异常

饶滨海
2023-03-14

这里是上下文:我已经成功地构建了以下命令的项目(调用从maven-释放插件在Jenkins)

mvn clean -Pall
mvn generate-sources -Pgs 
mvn -PjenkinsBuild install package assembly:single -Pall -Denvironment=dev

现在,当我尝试在Jenkins中使用maven-disres-plugin发布项目时,使用以下命令。失败了。(错误日志和最后的pom)

mvn -X release:prepare release:perform

尝试了一些不成功的解决方案:1。修改了maven发布插件的配置,怀疑开发者和Jenkins使用的是不同的SVN版本。

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-release-plugin</artifactId>
  <version>2.4.1</version>
  <configuration>
    <branchBase>${svn.base}/branches/releases</branchBase>
    <tagBase>${svn.base}/tags/releases/</tagBase>
    <autoVersionSubmodules>true</autoVersionSubmodules>
    <suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
    <remoteTagging>false</remoteTagging>
    <updateBranchVersions>true</updateBranchVersions>
    <updateWorkingCopyVersions>false</updateWorkingCopyVersions>
    <providerImplementations>
          <svn>javasvn</svn>
    </providerImplementations>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>com.google.code.maven-scm-provider-svnjava</groupId>
      <artifactId>maven-scm-provider-svnjava</artifactId>
      <version>2.0.6</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</plugin>

根据其中一项建议,尝试显式添加groupID

tc。strong查看strong查看soap客户端jar strong查看soap客户端

和POM的一部分

http://maven.apache.org/xsd/maven-4.0.0.xsd"

<groupId>tc.strongview</groupId>
<artifactId>strongview-etl-core</artifactId>
<version>0.2.0-SNAPSHOT</version>
<packaging>pom</packaging>

    <scm>
    <connection>
        scm:svn:https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
    </connection>
    <developerConnection>
        scm:svn:https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
    </developerConnection>
    <url>https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
    </url>
    </scm>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.3.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<modules>
    <module>strongview-etl-common</module>
    <module>strongview-soap-client</module>
    <module>strongview-etl-definitions</module>
</modules>

<distributionManagement>
...................................................
...................................................
...................................................
</distributionManagement>

<repositories>
...................................................
...................................................
...................................................
</repositories>

<profiles>
...................................................
...................................................
...................................................
</profile>

</profiles>

<properties>
...................................................
...................................................
...................................................
</properties>

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>2.9</version>
        </extension>
        <extension>
            <groupId>com.github.shyiko.servers-maven-extension</groupId>
            <artifactId>servers-maven-extension</artifactId>
            <version>1.3.0</version>
        </extension>
    </extensions>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.2</version>
            <configuration>
                <branchBase>${svn.base}/branches/releases</branchBase>
                <tagBase>${svn.base}/tags/releases/</tagBase>
                <autoVersionSubmodules>true</autoVersionSubmodules>
                <suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
                <remoteTagging>false</remoteTagging>
                <updateBranchVersions>true</updateBranchVersions>
                <updateWorkingCopyVersions>false</updateWorkingCopyVersions>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <descriptors>
                    <descriptor>${project.parent.basedir}/assembly/distribution.xml</descriptor>
                </descriptors>
                <appendAssemblyId>false</appendAssemblyId>
                <finalName>${distribution.name}</finalName>
                <includeProjectBuildFilters>true</includeProjectBuildFilters>
                <ignoreMissingDescriptor>true</ignoreMissingDescriptor>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>wagon-maven-plugin</artifactId>
            <version>1.0</version>
            <configuration>
                <serverId>${deployment.server}</serverId>
                <fromDir>${project.build.directory}</fromDir>
                <includes>${distribution.name}.zip</includes>
                <url>scp://${etl.server.url}:${etl.server.distribution.dir}</url>
            </configuration>
        </plugin>

    </plugins>
</build>

<dependencyManagement>
...................................................
...................................................
...................................................
</dependencies>

使用Maven 3.3.3和Maven release插件2.5.2以及简单的“发布:准备发布:执行”发布了新的错误日志

Started by user 
[EnvInject] - Loading node environment variables.
Building on master in workspace /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven
Cleaning up /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/.
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml.releaseBackup
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/release.properties
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-common/pom.xml.releaseBackup
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-soap-client/pom.xml.releaseBackup
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-definitions/pom.xml.releaseBackup
Updating https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 at revision '2015-08-04T15:33:30.474 -0400'
At revision 80
no change for https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 since the previous build
Parsing POMs
[strongview-etl-core-Release4 - Latest Maven] $ /opt/jdk1.8.0_45/bin/java -Xmx2048m -XX:MaxPermSize=512m -cp /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.4.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/boot/plexus-classworlds-2.5.2.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/conf/logging jenkins.maven3.agent.Maven31Main /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.36.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.4.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.4.jar 35483
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
<===[JENKINS REMOTING CAPACITY]===>channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven:  -B -f /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml -DdevelopmentVersion=0.2.1-SNAPSHOT -DreleaseVersion=0.2.0 -X -Dresume=false release:prepare release:perform
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-279.14.1.el6.x86_64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/conf/settings.xml
[DEBUG] Reading user settings from /home/jenkins/.m2/settings.xml
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] strongview-etl-core
[INFO] Strongview SOAP Client
[INFO] strongview-etl-common
[INFO] strongview-etl-definitions
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building strongview-etl-core 0.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.5.2:prepare (default-cli) @ strongview-etl-core ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **/pom.xml.releaseBackup, **/pom.xml.next, **/pom.xml.tag, **/pom.xml.branch, **/release.properties, **/pom.xml.backup
[INFO] Executing: /bin/sh -c cd "/data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven" && svn --non-interactive status
[INFO] Working directory: /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven
[DEBUG] ?       release.properties
[DEBUG] Ignoring changed file: release.properties
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'strongview-etl-core'...
[INFO]   Ignoring artifact version update for expression ${project.version}
[INFO]   Ignoring artifact version update for expression ${project.version}
[INFO] Transforming 'Strongview SOAP Client'...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] strongview-etl-core ................................ FAILURE [  2.944 s]
[INFO] Strongview SOAP Client ............................. SKIPPED
[INFO] strongview-etl-common .............................. SKIPPED
[INFO] strongview-etl-definitions ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.724 s
[INFO] Finished at: 2015-08-04T15:33:41-04:00
[INFO] Final Memory: 20M/139M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project strongview-etl-core: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project strongview-etl-core: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:328)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 31 more
Caused by: java.lang.NullPointerException
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.translateUrlPath(AbstractRewritePomsPhase.java:847)
    at org.apache.maven.shared.release.phase.RewritePomsForReleasePhase.translateScm(RewritePomsForReleasePhase.java:202)
    at org.apache.maven.shared.release.phase.RewritePomsForReleasePhase.transformScm(RewritePomsForReleasePhase.java:64)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformDocument(AbstractRewritePomsPhase.java:330)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:231)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:131)
    at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:116)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
    at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:286)
    at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:240)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    ... 32 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-definitions/pom.xml to tc.strongview/strongview-etl-definitions/0.2.0-SNAPSHOT/strongview-etl-definitions-0.2.0-SNAPSHOT.pom
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-soap-client/pom.xml to tc.strongview/strongview-soap-client/0.2.0-SNAPSHOT/strongview-soap-client-0.2.0-SNAPSHOT.pom
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-common/pom.xml to tc.strongview/strongview-etl-common/0.2.0-SNAPSHOT/strongview-etl-common-0.2.0-SNAPSHOT.pom
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml to tc.strongview/strongview-etl-core/0.2.0-SNAPSHOT/strongview-etl-core-0.2.0-SNAPSHOT.pom
channel stopped
Finished: FAILURE

共有2个答案

楮阳
2023-03-14

首先我想到的是什么。为什么要使用maven release plugin 2.2.2的一个古老版本,它是从2011年开始的?不是最新的版本吗?

为什么要使用一个非常有缺陷的Maven 3.0.3版本?至少不是3.0的最后一个。X释放线(3.0.5)?

此外,您这样称呼maven:

mvn clean -Pall
mvn generate-sources -Pgs 
mvn -PjenkinsBuild install package assembly:single -Pall -Denvironment=dev

这表明你不了解马文的生命周期。

如果调用mvn包将运行所有生命周期阶段,包括安装,这意味着调用:

mvn install package

没有道理。此外,您正在调用mvn。。。汇编:单个,也没有意义。您应该将maven assembly插件的执行绑定到生命周期。您在pom文件中配置的另一个点:

${project.parent.basedir}/汇编/distribution.xml

您不应该通过使用这样的配置离开当前模块的位置,这将导致麻烦。

realy Maven构建应该始终可以通过使用以下简单构建调用:

mvn clean deploy

如果您想发布,它应该是这样工作的:

mvn release:prepare release:perform

如果这不起作用,我并不惊讶您在使用CI服务器时遇到麻烦。

此外,您违反了SVN中的最佳实践。。。使用标记/主干/分支概念。

在日志中我可以看到以下内容:

Building on master in workspace /data/jenkins/workspace/strongview-etl-core-Release
Checking out a fresh workspace because there's no workspace at /data/jenkins/workspace/strongview-etl-core-Release
Cleaning local Directory .
Checking out https://xxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 at revision '2015-08-04T10:08:20.758 -0400'
.....................................................................................................................
.....................................................................................................................
.....................................................................................................................
AU        pom.xml
 U        .
At revision 77
no change for https://svn.transcontinental.ca/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 since the previous build
[strongview-etl-core-Release] $ /bin/sh -xe /data/jenkins/tmp/hudson5945883868250298288.sh
+ cd /data/jenkins/workspace/strongview-etl-core-Release/

这表明您已经在一个无法工作的标记上,因为要进行发布,您应该在pom文件中包含-SNAPSHOT版本的分支或主干上。。。这看起来不像。。

沈飞舟
2023-03-14

对我来说,它解析的scm标签和发布插件移到了child pom。这意味着从父pom中删除了scm标记和发布插件详细信息

 类似资料:
  • 运行Maven测试时出现此错误 执行目标组织失败。阿帕奇。专家插件:maven插件插件:3.2:项目amsframeworok上的描述符(默认描述符):提取插件描述符时出错:“未找到插件:ams5的mojo定义。0:amsframeworok。'- 下面是我的pom。xml

  • 我已经创建了一个maven项目。构建是成功的。但是我在尝试在我的maven项目中做标记准备(“mvn发布:准备”)时出现了以下错误。我在pom中添加了新的依赖项后收到了这个错误,如下所示。 请找出下面的错误。 [错误]无法执行目标组织。阿帕奇。专家插件:maven release插件:2.5.3:project print services上的prepare(默认cli):reactor proj

  • maven jar插件失败,错误如下: 无法执行目标组织。阿帕奇。专家plugins:maven-jar plugin:3.1.2:jar(默认jar)on project myProject:您必须使用分类器将补充工件附加到项目中,而不是替换它们。 我正在使用Java11。我将maven jar插件从2.4升级到了3.1.0。 它只在mvn清洁安装部署时失败。(没有部署,它正在正确运行)。 有什

  • 我正在做一个端到端的项目,包括后端和前端。前端工作正常(angular2框架、“npm启动”和“ng构建”工作正常)。但是,当我从project home文件夹运行“mvn clean install”时,它会给我一个错误,我对此一无所知: 在project home文件夹下,我可以成功运行“mvn compile”,但不能运行“mvn clean install”。它显示前端故障,并显示上面的错

  • 来自Eclipse火星版,pom。xml-Run-As-maven-clean,我得到了以下关于构建失败的错误消息 [ERROR]无法执行目标组织。阿帕奇。专家插件:maven clean插件:2.5:项目测试框架上的clean(默认清洁):目标组织的执行默认清洁。阿帕奇。专家插件:maven clean插件:2.5:clean失败:插件组织。阿帕奇。专家plugins:maven clean p

  • 执行目标组织失败。阿帕奇。专家插件:maven surefire插件:2.5-r682619-maestro-2.0.0:project ms61 webservice xxxx上的测试(默认测试):存在测试失败。这意味着什么以及如何解决它。我第一次做maven build。