Search code examples
mavennexusmaven-deploy-plugin

maven deploy test.jar to nexus via command line


I am using below command for uploading the old artifacts to new nexus as they cannot be rebuild.

mvn deploy:deploy-file 
  --settings=~/.m2/settings_att_nexus.xml 
  -DgroupId=com.org 
  -Dsources=someone-3.3.1-SNAPSHOT-sources.jar 
  -Djavadoc=someone-3.3.1-SNAPSHOT-javadoc.jar 
  -Dtestjar=someone-3.3.1-SNAPSHOT-tests.jar
  -DpomFile=someone-3.3.1-SNAPSHOT.pom 
  -DartifactId=someone 
  -Dversion=3.3.1-SNAPSHOT 
  -DgeneratePom=false -Dpackaging=jar 
  -DrepositoryId=snapshots 
  -Durl=http://someurl:8076/nexus/content/repositories/snapshots 
  -Dfile=someone-3.3.1-SNAPSHOT.jar

All required jars are uploaded successfully but someone-3.3.1-SNAPSHOT-tests.jar doesn't go into nexus which is passed as an argument to above command with below tag:

-Dtestjar=someone-3.3.1-SNAPSHOT-tests.jar

Can someone tell what is correct tag to maven deploy to uplaod test.jar in one go.


Solution

  • whats about your settings.xml? you should have something like this:

                [...]
                <repository>
                    <id>Snapshot</id>
                    <url>http://192.168.28.35/nexus/content/groups/public-snapshots</url>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </snapshots>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <layout>default</layout>
                </repository>
                [...]
    

    edit:

    as I saw, the "testjar" is not existing in the deploy plugin. you can try this:

    [...]
         -Dfiles=someone-3.3.1-SNAPSHOT-tests.jar
         -Dtypes=jar
         -Dclassifiers=tests
    [...]