03 November 2017

Deploy your maven project to the public repository

1. update your maven to look like https://github.com/mhewedy/sftp-utils/blob/master/pom.xml by adding the following:


<name>sftp-utils</name>
<description>SFTP Utils</description>
<url>https://github.com/mhewedy/sftp-utils</url>

<licenses>
    <license>
        <name>Apache License Version 2.0</name>
        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
</licenses>

<developers>
    <developer>
        <name>Muhammad Hewedy(mhewedy)</name>
        <email>mhewedy@gmail.com</email>
        <organization>mhewedy</organization>
        <organizationUrl>https://github.com/mhewedy</organizationUrl>
    </developer>
</developers>

<scm>
    <connection>scm:git:git@github.com:mhewedy/sftp-utils.git</connection>
    <developerConnection>scm:git:git@github.com:mhewedy/sftp-utils.git</developerConnection>
    <url>git@github.com:mhewedy/sftp-utils.git</url>
</scm>


And

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-source-plugin</artifactId>
    <executions>
        <execution>
            <id>attach-sources</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

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

<plugin>
    <groupId>org.sonatype.plugins</groupId>
    <artifactId>nexus-staging-maven-plugin</artifactId>
    <version>1.6.3</version>
    <extensions>true</extensions>
    <configuration>
        <serverId>ossrh</serverId>
        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
        <autoReleaseAfterClose>true</autoReleaseAfterClose>
    </configuration>
</plugin>

And change the values according to your project

Then create a ticket like this: https://issues.sonatype.org/browse/OSSRH-35670

Then after it is resolved as fixed, then execute from the project directory:

mvn clean deploy

and check https://oss.sonatype.org/content/groups/staging/ and https://oss.sonatype.org/content/groups/public for the artifacts, for example:
https://oss.sonatype.org/content/groups/public/com/github/mhewedy/sftp-utils/


No comments: