Maven 简单配置gpg

1. 下载maven到指定目录,指定对应的gpg的执行命令所需要的属性。这里比如下载解压后的maven目录是: C:\maven-apache-3.3.2 ,那么配置文件目录是: C:\maven-apache-3.3.2\conf\settings.xml

<profiles>
    <profile>
      <id>ossrh</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <gpg.executable>gpg2</gpg.executable>
        <gpg.passphrase>the_pass_phrase</gpg.passphrase>
      </properties>
    </profile>
  </profiles>

2. 在maven的pom.xml文件中配置运行的maven插件.

<plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <!-- <configuration> <executable>gpg</executable> <homedir>${gpg.homedir}</homedir> 
                                    <keyname>${gpg.keyname}</keyname> <passphrase>${gpg.passphrase}</passphrase> 
                                    </configuration> -->
                            </execution>
                        </executions>
                    </plugin>
3.在maven运行中指定对应的运行lifecycle : mvn clean install deploy  即可。

转载于:https://www.cnblogs.com/alterhu/p/5770502.html

上一篇:加密和安全


下一篇:ubuntu 安装 Visual Studio Code