java - Maven 部署到快照而不是发布

标签 java maven release snapshot

我正在尝试使用 maven 发布一个项目,但不是发布到 Releases 存储库,而是将它放在我们的 Snapshots 存储库中。

我的 pom 看起来像:

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.my.profiler</groupId>
<artifactId>profilerlib</artifactId>
<name>Profiler Lib</name>
<version>1.0.2-SNAPSHOT</version>
<description>Profiler Library</description>
<scm>
    <connection>scm:svn:https://svn.example.com/my-project/profilerlib/trunk
    </connection>
    <developerConnection>scm:svn:https://svn.example.com/my-project/profilerlib/trunk
    </developerConnection>
</scm>
<distributionManagement>
    <!-- Publish the versioned releases here -->
    <repository>
        <id>nexus</id>
        <name>nexus</name>
        <url>http://repo.example.com:8081/nexus/content/repositories/releases
        </url>
    </repository>
    <!-- Publish the versioned releases here -->
    <snapshotRepository>
        <id>nexus</id>
        <name>nexus</name>
        <url>http://repo.example.com:8081/nexus/content/repositories/snapshots
        </url>
    </snapshotRepository>
</distributionManagement>
<!-- download artifacts from this repo -->
<repositories>
    <repository>
        <id>nexus</id>
        <name>EXAMPLE Public Repository</name>
        <url>http://repo.example.com:8081/nexus/content/groups/public</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>
<dependencies>
    ...
</dependencies>
<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <tagBase>https://svn.example.com/my-project/profilerlib/tags
                </tagBase>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <powermock.version>1.4.6</powermock.version>
</properties>
</project>

最佳答案

如果其他人遇到此问题并找到现有答案并不能解决他们的问题:

有一些错误意味着 release:prepare 在创建发布标签之前不会提交到 git 存储库。这意味着 release:perform 找到的 pom 文件中的版本号包含 -SNAPSHOT 并且部署者将尝试发布到快照存储库。

这是导致此行为的最新缺陷:MRELEASE-875 (影响 2.5,在 2.5.1 中修复)

关于java - Maven 部署到快照而不是发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7332580/

相关文章:

Android版本发布警告消息: This App Bundle contains Java/Kotlin code,可能被混淆

java - 找不到 KeyStore 的 DB2 DataSource 属性

maven jetty插件log4j配置

java - 如何在 Micronaut 中下载(流式传输)大型(生成)文件

java - 通过pom.xml执行时编译错误

tomcat - 我如何在两个不同的环境中使用 maven tomcat 插件?

excel - 如何在VBA中释放对象并清除内存

java - 如何使用 maven 发布插件发布 Hotfix

java - 如何使用 jersey 中的 MediaType 类创建自定义 mime 类型?

java - 从运行时创建的 JTextField 获取值