Monday, August 10, 2020

Push a jar to maven central

 

Create a account to SonaType and create a jira request

      https://issues.sonatype.org/browse/OSSRH-59836

https://central.sonatype.org/pages/ossrh-guide.html

Generate a key of gpg.

https://central.sonatype.org/pages/working-with-pgp-signatures.html


follow the step from the below link.

https://central.sonatype.org/pages/requirements.html


https://central.sonatype.org/pages/apache-maven.html

https://oss.sonatype.org/#nexus-search;quick~sumankumar01

https://github.com/sumankumar01/SeleniumReport


My repository

https://repo1.maven.org/maven2/com/github/sumankumar01/SeleniumReport/

https://oss.sonatype.org/#nexus-search;quick~sumankumar01

<dependency>

  <groupId>com.github.sumankumar01</groupId>

  <artifactId>SeleniumReport</artifactId>

  <version>1.2.4</version>

</dependency>


mvn clean deploy

mvn versions:set -DnewVersion=1.2.4

mvn clean deploy -P release

Pom.xml for pushing the code

  

 

 

<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.sumankumar01</groupId>
  <artifactId>SeleniumReport</artifactId>
  <version>1.2.4</version>
  
    <build>
      <plugins>
     <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <compilerVersion>1.8</compilerVersion>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            
             <plugin>
      <groupId>org.sonatype.plugins</groupId>
      <artifactId>nexus-staging-maven-plugin</artifactId>
      <version>1.6.7</version>
      <extensions>true</extensions>
      <configuration>
        <serverId>ossrh</serverId>
        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
        <autoReleaseAfterClose>true</autoReleaseAfterClose>
      </configuration>
    </plugin>
    
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-source-plugin</artifactId>
      <version>2.2.1</version>
      <executions>
        <execution>
          <id>attach-sources</id>
          <goals>
            <goal>jar-no-fork</goal>
          </goals>
        </execution>
      </executions>
    </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>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-gpg-plugin</artifactId>
      <version>1.6</version>
      <executions>
        <execution>
          <id>sign-artifacts</id>
          <phase>verify</phase>
          <goals>
            <goal>sign</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
   
            </plugins>
    </build>
    
    <packaging>jar</packaging>
  
  <name>seleniumReport</name>
  <description>Simple Report for selenium</description>
  <url>https://github.com/sumankumar01/SeleniumReport.git</url>
  
  <licenses>
  <license>
    <name>The Apache License, Version 2.0</name>
    <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
  </license>
</licenses>

<distributionManagement>
  <snapshotRepository>
    <id>ossrh</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  </snapshotRepository>
  
  <repository>
    <id>ossrh</id>
    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
  </repository>
</distributionManagement>

<developers>
    <developer>
      <name>Suman Kumar</name>
      <email>suman.giri007@gmail.com</email>
      <organization>com.github.sumankumar01</organization>
      <organizationUrl>https://github.com/sumankumar01/SeleniumReport.git</organizationUrl>
    </developer>
  </developers>
  
  <scm>
  <connection>scm:git:git://gigithub.com/sumankumar01/SeleniumReport.git</connection>
  <developerConnection>scm:git:ssh://github.com/sumankumar01/SeleniumReport.git</developerConnection>
  <url>https://github.com/sumankumar01/SeleniumReport.git</url>
</scm>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>
</dependencies>

</project>

 Setting.xml


 <?xml version="1.0" encoding="UTF-8"?>

 

<!--

 | This is the configuration file for Maven. It can be specified at two levels:

 |

 |  1. User Level. This settings.xml file provides configuration for a single user,

 |                 and is normally provided in ${user.home}/.m2/settings.xml.

 |

 |                 NOTE: This location can be overridden with the CLI option:

 |

 |                 -s /path/to/user/settings.xml

 |

 |  2. Global Level. This settings.xml file provides configuration for all Maven

 |                 users on a machine (assuming they're all using the same Maven

 |                 installation). It's normally provided in

 |                 ${maven.home}/conf/settings.xml.

 |

 |                 NOTE: This location can be overridden with the CLI option:

 |

 |                 -gs /path/to/global/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">

          

  <!--  Change username in below line  -->        

  <localRepository>/Users/kumar/.m2/repository</localRepository>

 

  <interactiveMode>true</interactiveMode>

 

  <offline>false</offline>

 

  <pluginGroups>

    <!-- pluginGroup

     | Specifies a further group identifier to use for plugin lookup.

    <pluginGroup>com.your.plugins</pluginGroup>

    -->

  </pluginGroups>

 

  <proxies>

    <!--

    <proxy>

      <id>optional</id>

      <active>true</active>

      <protocol>http</protocol>

      <username>proxyuser</username>

      <password>proxypass</password>

      <host>proxy.host.net</host>

      <port>80</port>

      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>

    </proxy>

    -->

  </proxies>

 

  <servers>

   <server>

      <id>ossrh</id>

      <username>***********************</username>

      <password>***********************</password>

    </server>

  </servers>

 

  <mirrors>

    <!--

    <mirror>

      <id>mirrorId</id>

      <mirrorOf>repositoryId</mirrorOf>

      <name>mirror description</name>

      <url>http://my.repository.com/repo/path</url> 

    </mirror>

    -->

  </mirrors>

 

  <profiles>

   <profile>

      <id>ossrh</id>

      <activation>

        <activeByDefault>true</activeByDefault>

      </activation>

      <properties>

        <gpg.executable>gpg</gpg.executable>

        <gpg.passphrase>*****************************************</gpg.passphrase>

      </properties>

    </profile>

  </profiles>

 

</settings>

 

 

 

Push a jar to maven central

  Create a account to SonaType and create a jira request        https://issues.sonatype.org/browse/OSSRH-59836 https://central.sonatype.org/...