I have followed the blogs Maven Nexus Deploy and Maven Nexus Release to enable publishing my builds of modular Spring Boot application in Nexus. I am using Nexus opensource and Maven 3.6.0
My plan is to have a setup where I can publish both snapshots and releases based on the maven goal I am running. My current pom contains following details -
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>releases</releaseProfiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<distributionManagement>
<snapshotRepository>
<id>nexus-snapshots</id>
<url>http://localhost:8081/repository/snapshots</url>
</snapshotRepository>
<repository>
<id>nexus-releases</id>
<url>http://localhost:8081/repository/releases</url>
</repository>
</distributionManagement>
<scm>
// my scm details
</scm>
<profiles>
<profile>
<id>releases</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<serverId>nexus-releases</serverId>
<nexusUrl>http://localhost:8081/nexus/</nexusUrl>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
My maven settings.xml contains the server entries -
<server>
<id>nexus-releases</id>
<username>deployment</username>
<password>deployment</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>deployment</username>
<password>deployment</password>
</server>
When I run command
mvn -B release:clean release:prepare release:perform -Darguments="-DskipTests -Dmaven.javadoc.skip=true"
it works fine and my release build is uploaded to Nexus releases path.
My questions are -
Which command should I run so that my snapshot builds are created and uploaded to Nexus snapshots path?
If the command is
mvn clean deployI tried it and it still doesn't upload snapshot to Nexus. Output for deploy step in above command is -[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ company-service --- [INFO] Skipping artifact deployment
EDIT 1 -
I ran mvn clean deploy -X and the logs for deploy plugin are -
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ company-service ---
[DEBUG] Configuring mojo org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.2, parent: sun.misc.Launcher$AppClassLoader@7852e922]
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy' with basic configurator -->
[DEBUG] (f) artifact = com.exa:company-service:jar:0.0.13-SNAPSHOT
[DEBUG] (f) attachedArtifacts = []
[DEBUG] (f) deployAtEnd = false
[DEBUG] (s) localRepository = id: local
url: file:///root/.m2/repository/
layout: default
snapshots: [enabled => true, update => always]
releases: [enabled => true, update => always]
[DEBUG] (f) offline = false
[DEBUG] (f) packaging = jar
[DEBUG] (f) pomFile = /home/dell/repos/exa/exa-microservices/company-service/pom.xml
[DEBUG] (f) project = MavenProject: com.exa:company-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/company-service/pom.xml
[DEBUG] (f) reactorProjects = [MavenProject: com.exa:exa-microservices:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/pom.xml, MavenProject: com.exa:discovery-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/discovery-service/pom.xml, MavenProject: com.exa:gateway-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/gateway-service/pom.xml, MavenProject: com.exa:common-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/common-service/pom.xml, MavenProject: com.exa:auth-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/auth-service/pom.xml, MavenProject: com.exa:device-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/device-service/pom.xml, MavenProject: com.exa:installer-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/installer-service/pom.xml, MavenProject: com.exa:company-service:0.0.13-SNAPSHOT @ /home/dell/repos/exa/exa-microservices/company-service/pom.xml]
[DEBUG] (f) retryFailedDeploymentCount = 1
[DEBUG] (f) skip = true
[DEBUG] (f) updateReleaseInfo = false
[DEBUG] -- end configuration --
[INFO] Skipping artifact deployment
[INFO] ------------------------------------------------------------------------