1. Download maven to the specified directory, specifying the required properties for the corresponding GPG execution commands. Here, for example, download the extracted maven directory is: C:\maven-apache-3.3.2, then the configuration file directory is: 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. Configure the Maven plugin to run in Maven's Pom.xml file.
<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> - </Execution> </executions> </plugin>
3. Specify the corresponding run LIFECYCLE:MVN clean install deploy in the Maven run.
Maven Simple Configuration GPG