Maven 简单配置gpg

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

<profiles>
    <profile>
      <id>ossrhid>
      <activation>
        <activeByDefault>trueactiveByDefault>
      activation>
      <properties>
        <gpg.executable>gpg2gpg.executable>
        <gpg.passphrase>the_pass_phrasegpg.passphrase>
      properties>
    profile>
  profiles>

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

<plugin>
                        <groupId>org.apache.maven.pluginsgroupId>
                        <artifactId>maven-gpg-pluginartifactId>
                        <version>${maven-gpg-plugin.version}version>
                        <executions>
                            <execution>
                                <id>sign-artifactsid>
                                <phase>verifyphase>
                                <goals>
                                    <goal>signgoal>
                                goals>
                                
                            execution>
                        executions>
                    plugin>
3.在maven运行中指定对应的运行lifecycle : mvn clean install deploy  即可。

你可能感兴趣的:(Maven 简单配置gpg)