【发布时间】:2022-01-10 08:57:32
【问题描述】:
我想将项目的人工制品 .jar 发布到我的 nexus 存储库。但是,maven deploy 插件始终包含已部署工件的时间戳后缀。我按照文档省略了后缀,但没有任何效果 - 它仍在添加它。
文档指出<uniqueVersion></uniqueVersion> 应该设置为false,我在pom.xml 中为每个存储库配置做了这件事,我也将它用作mvn deploy -DuniqueVersion=false 之类的标志。但是没有任何效果。
Nexus 中的结果总是有提到的后缀
这是我的pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company.tools</groupId>
<artifactId>com.company.tools.myTool</artifactId>
<version>1.3-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.6</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.10</version>
</dependency>
<dependency>
<groupId>net.sf.jt400</groupId>
<artifactId>jt400</artifactId>
<version>9.4</version>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>nexus</id>
<name>Corporate Repository</name>
<url>http://192.168.141.10:8081/repository/maven-releases/</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<uniqueVersion>false</uniqueVersion>
<id>nexus</id>
<name>Corporate Snapshots</name>
<url>http://192.168.141.10:8081/repository/maven-snapshots/</url>
<layout>legacy</layout>
</snapshotRepository>
</distributionManagement>
</project>
知道我在这里遗漏或误解了什么吗?
【问题讨论】:
-
尝试使用
v3.0.0-M2并确保每次都部署新版本(不要覆盖已经部署的版本) -
这就是 Maven 快照的工作方式——您希望 Maven 存储库如何区分快照的不同版本,但在内部使用时间戳版本?从客户的角度来看,它只是
1.3-SNAPSHOT -
将您的版本从
1.3-SNAPSHOT更改为1.3(发布!) -
同时删除默认生命周期定义的maven-deploy-plugin的执行。