xuyuansheng
xuyuansheng

Reputation: 1

maven3.x deploy to nexus3 issue

pom.xml config:

<groupId>com.java.study</groupId>
    <artifactId>docker</artifactId>
<!--    <version>1.0</version>-->
    <version>1.0.SNAPSHOT</version>
    <packaging>jar</packaging>

 <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
            <!--            <version>2.2.5.RELEASE</version>-->
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
<distributionManagement>
        <!--部署项目产生的构件到远程仓库需要的信息-->
        <repository>
            <!-- id一定要和setting文件中server的id一致-->
            <id>maven-release</id>
            <name>jinko-it</name>
            <url>http://192.168.64.128:8081/repository/maven-releases/</url>
        </repository>
        
        <snapshotRepository>
            <id>maven-snapshot</id>
            <name>jinko-it-snapshot</name>
            <url>http://192.168.64.128:8081/repository/maven_m/</url>
        </snapshotRepository>
    </distributionManagement>

setting.xml config:


 <server>
            <!-- 和pom.xml文件中 distributionManagement.repository.id 一致-->
            <id>maven-release</id>
            <username>maven_deploy</username>
            <password>maven_deploy</password>
        </server>
        <server>
            <!-- 和pom.xml文件中 distributionManagement.snapshotRepository.id 一致-->
            <id>maven-snapshot</id>
            <username>maven_deploy</username>
            <password>maven_deploy</password>
        </server>

question: release deploy success but snapshot failed;

error message :

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project docker: Failed to deploy artifacts: Could not transfer artifact com.java.study:docker:jar:1.0.20211018.142205-1 from/to maven-snapshot (http://192.168.64.128:8081/repository/maven_d/): Failed to transfer file: http://192.168.64.128:8081/repository/maven_d/com/java/study/docker/1.0.20211018.142205-1/docker-1.0.20211018.142205-1.jar. Return code is: 400, ReasonPhrase: Repository version policy: SNAPSHOT does not allow version: 1.0.20211018.142205-1.

doc:

I see the official document has the following description:

Major Version Upgrade to version 3.0.0 Please note that the following parameter has been completely removed from the plugin configuration:

uniqueVersion As of Maven 3, snapshot artifacts will always be deployed using a timestamped version.

so, I want to know how to specify the version instead of using timestamped.

Upvotes: 0

Views: 235

Answers (1)

marcosnasp
marcosnasp

Reputation: 43

It seems your block presents error at tag :

    <version>1.0.SNAPSHOT</version>

It should be seems like:

    <version>1.0-SNAPSHOT</version>

For more information, see:

What exactly is a Maven Snapshot and why do we need it?

Upvotes: 1

Related Questions