mvn 打包报错 Unable to execute gpg command

报错详细内容:

Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign (sign-artifacts) on project jim: Unable to execute gpg command: Error while executing process. Cannot run program "gpg": error=2, No such file or directory -> [Help 1]


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

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

 

POM配置:

<build>
          <pluginManagement>
                <plugins>
                    <!-- GPG -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
             </pluginManagement>
  
  </build>

  

posted @ 2022-11-10 17:15  来自牧羊人  阅读(1456)  评论(0编辑  收藏  举报