maven-release-plugin将快照部署到archiva

时间:2014-02-02 14:57:09

标签: maven maven-release-plugin

如何强制mvn发布:执行部署到我的版本而不是我的快照存储库? release:perform总是部署SNAPSHOT版本。这没有任何意义恕我直言

我的pom.xml

<groupId>com.mydomain</groupId>
<artifactId>MyArtifactName</artifactId>
<version>1.0.6-SNAPSHOT</version>
<packaging>jar</packaging>


<name>MyArtifactName</name>
<url>http://maven.apache.org</url>
 <distributionManagement>
    <repository>
        <id>central</id>
        <url>http://repo.example.com/artifactory/libs-release-local</url>
        <name>libs-release-local</name>
    </repository>
    <snapshotRepository>
        <id>central</id>
        <url>http://repo.example.com/artifactory/libs-snapshot-local</url>
        <name>libs-snapshot-local</name>
    </snapshotRepository>
</distributionManagement>
<scm>
    <tag>HEAD</tag>
    <url>http://git.example.com/someUser/myproject</url>
    <connection>scm:git:git@git.example.com/someUser/myproject.git</connection>
    <developerConnection>scm:git:git@git.example.com/someUser/myproject.git</developerConnection>
</scm>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.4.2</version>
        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:8)

我发现了问题:问题是,当使用Git作为SCM时,我需要为maven-scm-provider-gitexe(版本2.4.2)更新maven-release-plugin依赖项:

<build>
    <plugins>
        ....
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.4.2</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-gitexe</artifactId>
                    <version>1.9</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

我在这里找到了解决方案:mvn release:prepare not committing changes to pom.xml

您可以在此处找到一个有效的示例:https://github.com/tarator/releaseplugintest