Maven - Creating GPG JARs Signatures

I am new to Maven and upload things to Sonatype, so the error may be obvious, but it is hiding from me. I am trying to load an artifact.

To do this, I run the following command

mvn clean assembly:single -s settings.xml assembly:single javadoc:jar source:jar gpg:sign -Dgpg.passphrase=myPassphrase install deploy

However, this causes Nexus to crash when checking JAR files, because there are no signature signature files in the download, which is true, but I don’t understand why. In addition, there are, however, signatures for the .xml and .zip, .tar.gz, and .tar.bz2 files. What should I specify to create ask for a jar?

Below are my settings.xml and pom.xml files:

settings.xml:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <servers>
    <server>
      <id>sonatype</id>
      <username>myUsername</username>
      <password>myPassword</password>
    </server>
  </servers>

</settings>

pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.github.aaryn101</groupId>
  <artifactId>lol4j</artifactId>
  <version>2.0</version>
  <packaging>jar</packaging>

  <name>lol4j</name>
  <description>lol4j is a Java wrapper for the Riot Games LoL beta API.</description>
  <url>https://github.com/aaryn101/lol4j</url>

  <licenses>
    <license>
      <name>The MIT License (MIT)</name>
      <url>http://opensource.org/licenses/MIT</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <url>https://github.com/aaryn101/lol4j.git</url>
  </scm>

  <distributionManagement>
  <repository>
    <id>sonatype</id>
    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
  </repository>
  </distributionManagement>

<build>
  <plugins>
    <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <descriptor>dep.xml</descriptor>
        </configuration>
    </plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-javadoc-plugin</artifactId>
      <version>2.9.1</version>
      <executions>  
        <execution>
          <id>attach-javadocs</id>
          <goals>
            <goal>jar</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <artifactId>maven-source-plugin</artifactId>
      <version>2.2.1</version>
      <executions>
        <execution>
          <id>attach-sources</id>
          <goals>
            <goal>jar</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>
</project>
+4
source share
1 answer

maven, , . . , .

- ( ).

settings.xml, PGP Maven:

<profiles>
      <profile>
          <id>gpg</id>
          <properties>
              <gpg.passphrase>your passphrase</gpg.passphrase>
              <gpg.keyname>your pgp key</gpg.keyname>
          </properties>
      </profile>
  </profiles>

pom.xml, :

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-gpg-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
                <goal>sign</goal>
            </goals>
        </execution>
    </executions>
  </plugin>  

pom.xml.

+4

Source: https://habr.com/ru/post/1535624/


All Articles