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  即可。
posted @ 2016-08-14 16:53  高级测试开发网  阅读(9666)  评论(0编辑  收藏  举报
了解开发资源最新动态:https://seniortesting.club