Skip to content

Commit 7ffe91a

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 532926b commit 7ffe91a

File tree

2 files changed

+52
-8
lines changed

2 files changed

+52
-8
lines changed

.travis.yml

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

2020
after_success:
2121
- ./mvnw jacoco:report coveralls:report
22-
- "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} == '' ]] && ./mvnw deploy -DreposityId=sonatype-nexus-snapshots -DskipTests --settings deploy-settings.xml"
23-
- "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} != '' ]] && ./mvnw deploy -DreposityId=sonatype-nexus-staging -DskipTests -Drevision=${TRAVIS_TAG} -DdisableSpringSnapshots=true --settings deploy-settings.xml"
22+
- "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} == '' ]] && ./mvnw deploy -DrepositoryId=sonatype-nexus-snapshots -DskipTests --settings deploy-settings.xml"
23+
- "[[ ${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: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
<flatten-maven-plugin.version>1.0.1</flatten-maven-plugin.version>
6363
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
6464
<checkstyle.version>8.8</checkstyle.version>
65+
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
6566
</properties>
6667
<modules>
6768
<module>spring-boot-admin-server</module>
@@ -345,6 +346,21 @@
345346
<artifactId>asciidoctor-maven-plugin</artifactId>
346347
<version>${asciidoctor-maven-plugin.version}</version>
347348
</plugin>
349+
<plugin>
350+
<groupId>org.jacoco</groupId>
351+
<artifactId>jacoco-maven-plugin</artifactId>
352+
<version>${jacoco-maven-plugin.version}</version>
353+
</plugin>
354+
<plugin>
355+
<groupId>org.eluder.coveralls</groupId>
356+
<artifactId>coveralls-maven-plugin</artifactId>
357+
<version>${coveralls-maven-plugin.version}</version>
358+
</plugin>
359+
<plugin>
360+
<groupId>org.sonatype.plugins</groupId>
361+
<artifactId>nexus-staging-maven-plugin</artifactId>
362+
<version>${nexus-staging-maven-plugin.version}</version>
363+
</plugin>
348364
</plugins>
349365
</pluginManagement>
350366
</build>
@@ -404,17 +420,16 @@
404420
<artifactId>jacoco-maven-plugin</artifactId>
405421
<version>${jacoco-maven-plugin.version}</version>
406422
<executions>
407-
<!-- Prepares the property pointing to the JaCoCo
408-
runtime agent which is passed as VM argument when Maven the Surefire plugin
409-
is executed. -->
423+
<!-- Prepares the property pointing to the JaCoCo runtime agent which is passed as
424+
VM argument when Maven the Surefire plugin is executed. -->
410425
<execution>
411426
<id>pre-unit-test</id>
412427
<goals>
413428
<goal>prepare-agent</goal>
414429
</goals>
415430
</execution>
416-
<!-- Ensures that the code coverage report for
417-
unit tests is created after unit tests have been run. -->
431+
<!-- Ensures that the code coverage report for unit tests is created after unit tests have
432+
been run. -->
418433
<execution>
419434
<id>post-unit-test</id>
420435
<phase>test</phase>
@@ -427,7 +442,36 @@
427442
<plugin>
428443
<groupId>org.eluder.coveralls</groupId>
429444
<artifactId>coveralls-maven-plugin</artifactId>
430-
<version>${coveralls-maven-plugin.version}</version>
445+
</plugin>
446+
447+
<!-- We need to deploy using the nexus-staging-maven-plugin specifying a stagingProfileId. This is to
448+
workaround the problem that travis uploads the artifacts using different ip addresses resulting
449+
in multiple staging repositories -->
450+
<plugin>
451+
<groupId>org.apache.maven.plugins</groupId>
452+
<artifactId>maven-deploy-plugin</artifactId>
453+
<configuration>
454+
<skip>true</skip>
455+
</configuration>
456+
</plugin>
457+
<plugin>
458+
<groupId>org.sonatype.plugins</groupId>
459+
<artifactId>nexus-staging-maven-plugin</artifactId>
460+
<executions>
461+
<execution>
462+
<id>default-deploy</id>
463+
<phase>deploy</phase>
464+
<goals>
465+
<goal>deploy</goal>
466+
</goals>
467+
</execution>
468+
</executions>
469+
<configuration>
470+
<serverId>${repositoryId}</serverId>
471+
<nexusUrl>https://oss.sonatype.org</nexusUrl>
472+
<!-- explicit matching using the staging profile id -->
473+
<stagingProfileId>1e79a0f1acc1b8</stagingProfileId>
474+
</configuration>
431475
</plugin>
432476
</plugins>
433477
</build>

0 commit comments

Comments
 (0)