6

maven deploy does not work for versions

 2 years ago
source link: https://www.codesd.com/item/maven-deploy-does-not-work-for-versions.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

maven deploy does not work for versions

advertisements

Hi I am a beginner for maven build tool. I built a simple maven JavaEE project and I tried to build it remote nexus repository. But i can deploy successfully only for snapshots. Releases deploying gives 400 bad request error.

here is my Setting.xml configuration

     <servers>
            <server>
                    <id>****</id>
                    <username>****</username>
                    <password>****</password>
            </server>
    </servers>

    <mirrors>
        <mirror>
                <id>nexus</id>
                <mirrorOf>central</mirrorOf>
                <url>http://******:8081/nexus/content/groups/net.******.timetrack/</url>
        </mirror>
    </mirrors>

<profiles>
    <profile>
            <id>nexus</id>
            <repositories>
                <repository>
                    <id>*****</id>
                    <url>http://******:8081/nexus/content/groups/net.*******.timetrack/</url>
                    <releases><enabled>true</enabled></releases>
                    <snapshots><enabled>true</enabled></snapshots>
                </repository>
            </repositories>

            <pluginRepositories>
                <pluginRepository>
                    <id>******</id>
                    <url>http://******:8081/nexus/content/groups/net.******.timetrack/</url>
                    <releases><enabled>true</enabled></releases>
                    <snapshots><enabled>true</enabled></snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
</profiles>

<activeProfiles>
            <activeProfile>nexus</activeProfile>
</activeProfiles>

and here is my pom.xml's distribution management

<distributionManagement>
        <repository>
            <uniqueVersion>false</uniqueVersion>
            <id>*****</id>
            <name>******</name>
            <url>http://*******:8081/nexus/content/groups/net.******.timetrack/</url>
            <layout>default</layout>
        </repository>
        <snapshotRepository>
            <uniqueVersion>true</uniqueVersion>
            <id>*****</id>
            <name>***** Snapshots</name>
            <url>http://******:8081/nexus/content/repositories/snapshots/</url>
            <layout>legacy</layout>
        </snapshotRepository>
    </distributionManagement>

If I run mvn clean deploy with (for a snapshot)

<groupId>net.*****.*****</groupId>
<artifactId>*****-**-****</artifactId>
<version>1.4-SNAPSHOT</version>
<packaging>war</packaging>

then successfully deploy in to nexus repository snapshot directory.

If it I run mvn clean deploy with (for a release)

<groupId>net.*****.****</groupId>
<artifactId>****-***-*****</artifactId>
<version>1.4.1</version>
<packaging>war</packaging>

then it gives 400-bad request error

Here is the log for the error

[INFO]
[INFO] --- maven-war-plugin:2.6:war (default-war) @ ****-****-***** ---
[INFO] Packaging webapp
[INFO] Assembling webapp [*****-time-tracker] in [/home/dilanka/Projects/time_tracker/samples/GitLab/****/***-time-tracker/target/*****-time-tracker-1.4]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/dilanka/Projects/time_tracker/samples/GitLab/*****/****-time-tracker/src/main/webapp]
[INFO] Webapp assembled in [115 msecs]
[INFO] Building war: /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/*****-time-tracker/target/****-time-tracker-1.4.war
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ ****-time-tracker ---
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/target/****-time-tracker-1.4.war to /home/dilanka/maven3-repo/net/*****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.war
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/pom.xml to /home/dilanka/maven3-repo/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ ****-time-tracker ---
Uploading: http://*****:8081/nexus/content/groups/net.*****.timetrack/net/****s/timetrack/***-time-tracker/1.4/****-time-tracker-1.4.war
Uploading: http://*****:8081/nexus/content/groups/net.****.timetrack/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.790 s
[INFO] Finished at: 2016-01-08T15:28:08+05:30
[INFO] Final Memory: 32M/252M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ****-time-tracker: Failed to deploy artifacts: Could not transfer artifact net.****.timetrack:*****-time-tracker:war:1.4 from/to ***** (http://*****:8081/nexus/content/groups/net.****.timetrack/): Failed to transfer file: http://*****:8081/nexus/content/groups/net.****.timetrack/net/*****/timetrack/*****-time-tracker/1.4/****-time-tracker-1.4.war. Return code is: 400, ReasonPhrase: Bad Request. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

If any body please help me to solve this problem.

Thanks.


You can deploy a release version of a given artifact exactly once to a given Nexus instance.

If the same version already exists in your Nexus, you'll get an error like the one you're seeing.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK