Skip to content

Commit

Permalink
Setup maven staging to OSSRH (Maven Central)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaaano committed Apr 11, 2017
1 parent 05e4697 commit 5cc8d9c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@ before_install:
fi

install:
- mvn install -DskipTests=true -B -V -Psign -Dgpg.passphrase=$GPG_PASSPHRASE
- mvn deploy -B -V -DskipTests -Dgpg.passphrase=$GPG_PASSPHRASE -Psign --settings settings.xml

script:
- mvn test -B

after_success:
- if [ -n "$TRAVIS_TAG" ]; then
mvn nexus-staging:release --settings settings.xml;
fi

after_failure:
- if [ -n "$TRAVIS_TAG" ]; then
mvn nexus-staging:drop --settings settings.xml;
fi

deploy:
provider: releases
api_key:
Expand Down
22 changes: 22 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
<developerConnection>scm:git:[email protected]:juliaaano/payload.git</developerConnection>
</scm>

<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>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -185,6 +196,17 @@
</executions>
</plugin>

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

</plugins>

</build>
Expand Down
12 changes: 12 additions & 0 deletions settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
</servers>
</settings>

0 comments on commit 5cc8d9c

Please sign in to comment.