【发布时间】:2020-10-19 14:37:59
【问题描述】:
我关注了博客Maven Nexus Deploy 和Maven Nexus Release,以便在 Nexus 中发布我构建的模块化 Spring Boot 应用程序。我正在使用 Nexus 开源和 Maven 3.6.0
我的计划是有一个设置,我可以根据我正在运行的 maven 目标发布快照和版本。我当前的 pom 包含以下详细信息 -
<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>
我的 maven settings.xml 包含服务器条目 -
<server>
<id>nexus-releases</id>
<username>deployment</username>
<password>deployment</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>deployment</username>
<password>deployment</password>
</server>
当我运行命令时
mvn -B release:clean release:prepare release:perform -Darguments="-DskipTests -Dmaven.javadoc.skip=true"
它工作正常,我的发布版本已上传到 Nexus 发布路径。
我的问题是 -
-
我应该运行哪个命令来创建我的快照版本并将其上传到 Nexus 快照路径?
-
如果命令是
mvn clean deploy,我试过了,它仍然没有将快照上传到 Nexus。上述命令中部署步骤的输出是 -[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ company-service --- [INFO] 跳过工件部署
编辑 1 -
我跑了mvn clean deploy -X,部署插件的日志是-
[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] ------------------------------------------------------------------------
【问题讨论】: