maven install 报错: Failed to execute goalorg.apache.maven.plugins:maven-gpg-plugin:1.4:sign

本文解决了一个常见的Maven构建问题:在使用maven-gpg-plugin进行签名时出现的“Cannot obtain passphrase in batch mode”错误。该问题通常发生在Maven 3.x版本上。文章提供了解决方案,即通过在项目的pom.xml文件中引入pluginManagement来修正。

本解决方案转自:http://blog.youkuaiyun.com/tangximing123/article/details/21179467

 

执行 Maven install 时报错:

 Failed to execute goalorg.apache.maven.plugins:maven-gpg-plugin:1.4:sign (sign-artifacts)on project openstack-java-sdk: Cannot obtain passphrase in batchmode -> [Help 1]

 

如下:

[INFO] BUILD FAILURE
[INFO]------------------------------------------------------------------------
[INFO] Total time: 0.970s
[INFO] Finished at: Tue Mar 04 14:06:04 CST 2014
[INFO] Final Memory: 7M/87M
[INFO]------------------------------------------------------------------------
[ERROR] Failed to execute goalorg.apache.maven.plugins:maven-gpg-plugin:1.4:sign (sign-artifacts)on project openstack-java-sdk: Cannot obtain passphrase in batchmode -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Mavenwith the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debuglogging.
[ERROR]
[ERROR] For more information about the errors and possiblesolutions, please read the following articles:
[ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

 

原因: 使用的版本是maven3.X,其执行maven-ant-plugin的行为和maven2.x有一定的不同,需要引入pluginManagement

 

解决办法:在pom.xml中引入:

之前的内容:

<build>
   <plugins>
       <plugin></plugin>
       ...       
       <plugin></plugin>
   </plugins>
</build>

修改后的内容:

 

<build>
   <pluginManagement>
       <plugins>
          <plugin></plugin>
          ...  
         <plugin></plugin>
        </plugins>
    </pluginManagement>
</build>

 

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值