Skip to content

Commit c4785b0

Browse files
committed
Deploy using nexus-staging-maven-plugin
We need to deploy using the nexus-staging-maven-plugin specifying a stagingProfileId. This is to workaround the problem that travis uploads the artifacts using different ip addresses resulting in multiple staging repositories.
1 parent 329441d commit c4785b0

File tree

2 files changed

+42
-7
lines changed

2 files changed

+42
-7
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ script: ./mvnw verify ${TRAVIS_TAG:+-Drevision=${TRAVIS_TAG} -DdisableSpringSnap
1818

1919
after_success:
2020
- ./mvnw jacoco:report coveralls:report
21-
- "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} == '' ]] && ./mvnw deploy -DreposityId=sonatype-nexus-snapshots -DskipTests --settings deploy-settings.xml"
22-
- "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} != '' ]] && ./mvnw deploy -DreposityId=sonatype-nexus-staging -DskipTests -Drevision=${TRAVIS_TAG} -DdisableSpringSnapshots=true --settings deploy-settings.xml"
21+
- "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} == '' ]] && ./mvnw deploy -DrepositoryId=sonatype-nexus-snapshots -DskipTests --settings deploy-settings.xml"
22+
- "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} != '' ]] && ./mvnw deploy -DrepositoryId=sonatype-nexus-staging -DskipTests -Drevision=${TRAVIS_TAG} -DdisableSpringSnapshots=true --settings deploy-settings.xml"

pom.xml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
<flatten-maven-plugin.version>1.0.1</flatten-maven-plugin.version>
6666
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
6767
<checkstyle.version>8.14</checkstyle.version>
68+
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
6869
</properties>
6970
<modules>
7071
<module>spring-boot-admin-server</module>
@@ -358,6 +359,11 @@
358359
<artifactId>coveralls-maven-plugin</artifactId>
359360
<version>${coveralls-maven-plugin.version}</version>
360361
</plugin>
362+
<plugin>
363+
<groupId>org.sonatype.plugins</groupId>
364+
<artifactId>nexus-staging-maven-plugin</artifactId>
365+
<version>${nexus-staging-maven-plugin.version}</version>
366+
</plugin>
361367
</plugins>
362368
</pluginManagement>
363369
</build>
@@ -416,17 +422,16 @@
416422
<groupId>org.jacoco</groupId>
417423
<artifactId>jacoco-maven-plugin</artifactId>
418424
<executions>
419-
<!-- Prepares the property pointing to the JaCoCo
420-
runtime agent which is passed as VM argument when Maven the Surefire plugin
421-
is executed. -->
425+
<!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as
426+
VM argument when Maven the Surefire plugin is executed. -->
422427
<execution>
423428
<id>pre-unit-test</id>
424429
<goals>
425430
<goal>prepare-agent</goal>
426431
</goals>
427432
</execution>
428-
<!-- Ensures that the code coverage report for
429-
unit tests is created after unit tests have been run. -->
433+
<!-- Ensures that the code coverage report for unit tests is created after unit tests have
434+
been run. -->
430435
<execution>
431436
<id>post-unit-test</id>
432437
<phase>test</phase>
@@ -440,6 +445,36 @@
440445
<groupId>org.eluder.coveralls</groupId>
441446
<artifactId>coveralls-maven-plugin</artifactId>
442447
</plugin>
448+
449+
<!-- We need to deploy using the nexus-staging-maven-plugin specifying a stagingProfileId. This is to
450+
workaround the problem that travis uploads the artifacts using different ip addresses resulting
451+
in multiple staging repositories -->
452+
<plugin>
453+
<groupId>org.apache.maven.plugins</groupId>
454+
<artifactId>maven-deploy-plugin</artifactId>
455+
<configuration>
456+
<skip>true</skip>
457+
</configuration>
458+
</plugin>
459+
<plugin>
460+
<groupId>org.sonatype.plugins</groupId>
461+
<artifactId>nexus-staging-maven-plugin</artifactId>
462+
<executions>
463+
<execution>
464+
<id>default-deploy</id>
465+
<phase>deploy</phase>
466+
<goals>
467+
<goal>deploy</goal>
468+
</goals>
469+
</execution>
470+
</executions>
471+
<configuration>
472+
<serverId>${repositoryId}</serverId>
473+
<nexusUrl>https://oss.sonatype.org</nexusUrl>
474+
<!-- explicit matching using the staging profile id -->
475+
<stagingProfileId>1e79a0f1acc1b8</stagingProfileId>
476+
</configuration>
477+
</plugin>
443478
</plugins>
444479
</build>
445480
</profile>

0 commit comments

Comments
 (0)