Skip to content

Instantly share code, notes, and snippets.

@thombergs
Last active June 27, 2023 05:03
Show Gist options
  • Save thombergs/6653895 to your computer and use it in GitHub Desktop.
Save thombergs/6653895 to your computer and use it in GitHub Desktop.
Using Maven to deploy to Maven Central
mvn -s settings.xml clean javadoc:jar source:jar gpg:sign -Dgpg.passphrase=your_passphrase deploy
mvn clean javadoc:jar source:jar gpg:sign -Dgpg.passphrase=your_passphrase install
<distributionManagement>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
</distributionManagement>
<build>
<plugins>
<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>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<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>your_username</username>
<password>your_password</password>
</server>
</servers>
</settings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment