Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven deploy:deploy-file working but maven deploy not working

I'm trying to deploy maven artifacts into Artifactory repository using command : maven deploy .

I followed instructions from Maven documentation and JFrog :

https://maven.apache.org/plugins/maven-deploy-plugin/usage.html

https://www.jfrog.com/confluence/display/RTF/Maven+Repository#MavenRepository-DeployingArtifactsThroughArtifactory

For the moment, maven deploy:deploy-file works.

I assume credentials stored in settings.xml and corresponding repository id are correct.

But when running maven deploy I got the error :

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project my-app: Failed to deploy artifacts: Could not transfer artifact com.mvn.deployment:my-app:jar:1.0-20190518.184733-1 from/to snapshots

Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

Do you have any idea why would deploy-file work and deploy is not working ?

Thanks

maven deploy:deploy-file working :

mvn deploy:deploy-file -Durl=REPO_URL \
                      -DrepositoryId="snapshots" \
                      -Dfile=PATH_TO_JAR \
                      -DgroupId="Project" \
                      -DartifactId="test-project" \
                      -Dversion="0.0.1-SNAPSHOT"

While mvn deploy gives an error :

mvn deploy

ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-
plugin:2.8.2:deploy (default-deploy) on project my-app: Failed to deploy 
artifacts: Could not transfer artifact 
com.mvn.deployment:my-app:jar:1.0-20190518.184733-1 from/to snapshots

Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]

UPDATE :

I did some tests using different versions of maven and found the problem appears from version 3.5.0, the mvn deploy command works on maven 3.3.9 and I think it's related to new version of maven-wagon as in version 3.5.0 they upgraded Maven Wagon from 2.10 to 2.12.

By adding this config to my pom.xml mvn deploy works :

  <extension>
     <groupId>org.apache.maven.wagon</groupId>
     <artifactId>wagon-http</artifactId>
     <version>2.10</version>
  </extension>
like image 866
Hamza Avatar asked Oct 20 '25 09:10

Hamza


1 Answers

I did some tests using different versions of maven and found the problem appears from version 3.5.0, the mvn deploy command works on maven 3.3.9 and I think it's related to new version of maven-wagon as in version 3.5.0 they upgraded Maven Wagon from 2.10 to 2.12.

By adding this config to my pom.xml mvn deploy works :

<build>
     <plugins>
         <!-- It is a good idea to also set the maven-deploy-plugin version here -->
     </plugins>
     <extensions>
         <extension>
             <groupId>org.apache.maven.wagon</groupId>
             <artifactId>wagon-http</artifactId>
             <version>2.10</version>
         </extension>
     </extension>
</build>

Thanks Adrien for the maven-deploy-plugin version advice.

like image 67
Hamza Avatar answered Oct 22 '25 22:10

Hamza