Maven deploy error HTTP method PUT is not supported by this URL - maven

If I use this command I can upload into Nexus...
mvn deploy:deploy-file -Dfile=target/common-2.0.0.jar -DgroupId=com.test -DartifactId=test-common -Dversion=2.0.0 -Dpackaging=jar -DrepositoryId=TEST-REPO -Durl=https://nexus.xxx.xxxx.net/content/repositories/test
If I use this command
mvn deploy -DskipTests -DrepositoryId=TEST-REPO -DaltReleaseDeploymentRepository=releases::default::https://nexus.xxxx.xxxx.net/repository/test/
I get this error message...
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) # common ---
[INFO] Using alternate deployment repository releases::default::https://nexus.xxx.xxx.net/repository/test/
Uploading to releases: https://nexus.xxx.xxx.net/repository/test/com/test/common/2.0.0/common-2.0.0.jar
Uploading to releases: https://nexus.xxx.xxx.net/repository/test/com/test/common/2.0.0/common-2.0.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:08 min
[INFO] Finished at: 2019-05-16T14:55:35+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project common:
Failed to deploy artifacts: Could not transfer artifact
com.test:common:jar:2.0.0 from/to releases (https://nexus.xxx.xxx.net/repository/test/):
Failed to transfer file: https://nexus.xxx.xxx.net/repository/test/common/common-2.0.0.jar. Return code is: 400, ReasonPhrase: HTTP method PUT is not supported by this URL. -> [Help 1]
Does anyone know if the command "deploy:deploy-file" uses HTTP POST but the command "deploy" uses HTTP PUT?
Or how I can force it to use HTTP POST?
Note:
The Nexus version is: Nexus Repository Manager OSS 2.14.4-03
Maven version is 3.0.5, and have tried 3.6.1
I found out that...
POST uploads are not supported in Nexus 3. Use a PUT instead.

Related

Error while storing artifacts to Nexus through Jenkins

I was trying to store artifacts to Nexus.
When trying using the Command line using mvn clean package deploy the Build Sucess and Artifacts are stored in the desired Nexus repository.
Now trying the same code With Jenkins with Goals and Option clean package deploy till package it is done successfully and after that, it shows error
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) # maven-webapp ---
[INFO] Downloading from deployment: http://localhost:8081/repository/sample-snap/com/infy/demos/maven-webapp/0.0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.infy.demos:maven-webapp:0.0.1-SNAPSHOT/maven-metadata.xml from/to deployment (http://localhost:8081/repository/sample-snap/): Not authorized
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.173 s
[INFO] Finished at: 2019-11-25T12:22:12+05:30
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project maven-webapp: Failed to retrieve remote metadata com.infy.demos:maven-webapp:0.0.1-SNAPSHOT/maven-metadata.xml: Could not transfer metadata com.infy.demos:maven-webapp:0.0.1-SNAPSHOT/maven-metadata.xml from/to deployment (http://localhost:8081/repository/sample-snap/): Not authorized -> [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
[JENKINS] Archiving C:\Program Files (x86)\Jenkins\workspace\maven-demo\pom.xml to com.infy.demos/maven-webapp/0.0.1-SNAPSHOT/maven-webapp-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving C:\Program Files (x86)\Jenkins\workspace\maven-demo\target\maven-webapp.war to com.infy.demos/maven-webapp/0.0.1-SNAPSHOT/maven-webapp-0.0.1-SNAPSHOT.war
channel stopped
Finished: FAILURE
Already configure Nexus Repository Manager Servers in the Jenkins and tested the connection showing Nexus Repository Manager 3.x connection succeeded.
Using Nexus OSS 3.19.1-01.

Artifactory maven virtual repository 404s

I am trying to use a maven virtual repository that is linked up to an SBT local repository to resolve dependencies, but I keep getting 404s when I try to download the artifacts. They are listed fine on the UI, but right clicking on the artifacts and hitting "Download" give me a 404 error. Has anyone run into this problem. We're using JFrogs cloud hosted version of Artifactory on AWS. Our virtual Gradle repository is setup the same way and works as expected ...
mvn install output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.example:myjar:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.220 s
[INFO] Finished at: 2018-04-13T10:41:55-03:00
[INFO] Final Memory: 9M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project my-app: Could not resolve dependencies for project com.mycompany.app:my-app:jar:1.0-SNAPSHOT: Failure to find com.example:myjar:jar:1.0-SNAPSHOT in https://example.jfrog.io/example/maven was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
It seems that there are differences between snapshot policies between your local repositories referenced from the virtual one.
https://www.jfrog.com/jira/browse/RTFACT-17521

Running maven within docker - Name or service not known: Unknown host mvn

I am running Maven within Docker as part of a Jenkins build and encountering a problem where maven seems to be unable to download any of the dependencies.
Whether I run this from Jenkins, or directly from the command line I get this error. I have tried running the command as the root user, and as the jenkins user, but get the same result.
run -v "$(pwd)":/usr/share/tomcat7/.jenkins/workspace/MyProject/main -w /usr/share/tomcat7/.jenkins/workspace/MyProject/main maven mvn clean install -DskipTests
...produces the following output:
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.mycompany:myproject >--------------------------
[INFO] Building MyProject rolling
[INFO] --------------------------------[ pom ]---------------------------------
Downloading from central: http://mvn/repo/org/apache/maven/plugins/maven-jar-plugin/2.2/maven-jar-plugin-2.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.571 s
[INFO] Finished at: 2018-03-12T15:24:53Z
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-jar-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-jar-plugin:jar:2.2: Could not transfer artifact org.apache.maven.plugins:maven-jar-plugin:pom:2.2 from/to central (http://mvn/repo): mvn: Name or service not known: Unknown host mvn: Name or service not known -> [Help 1]

Nexus Artefact Upload Failure

using maven deploy command, I tried to upload artefacts of size (440 MB) in Nexus repository(Nexus Version : nexus-professional-2.13.0-01). Maven version is 3.5.2. Configured my proxy server details in settings.xml
mvn -e -X deploy:deploy-file -DgroupId=de.test.oca -DartifactId=wildfly-image -Dversion=0.0.1-SNAPSHOT -Dpackaging=tar.gz -Dfile=oca-wildfly-image-0.0.1-snapshot.tar.gz -DrepositoryId=oca-snapshots -Durl=http://xx.xx.xx:8081/nexus/content/repositories/oca-snapshots
Error Message :
Uploaded to oca-snapshots: http://xx.xx.xx:8081/nexus/content/repositories/oca-snapshots/de/test/oca/wildfly-image/0.0.1-SNAPSHOT/wildfly-image-0.0.1-20180117.094348-1.pom (446 B at 1.2 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 07:07 min
[INFO] Finished at: 2018-01-17T10:50:54+01:00
[INFO] Final Memory: 10M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact de.test.oca:wildfly-image:tar.gz:0.0.1-20180117.094348-1 from/to oca-snapshots (http://xx.xx.xx:8081/nexus/content/repositories/oca-snapshots): Connection reset -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Failed to deploy artifacts: Could not transfer artifact de.test.oca:wildfly-image:tar.gz:0.0.1-20180117.094348-1 from/to oca-snapshots (http://xx.xx.xx:8081/nexus/content/repositories/oca-snapshots): Connection reset
In Nexus GUI, I can able to find the tar.gz file uploaded. When I checked nexus.log, I found error message as
jvm 1 | 2018-01-17 14:27:17,706+0100 INFO [qtp1148931253-265705] admin com.sonatype.nexus.plugins.outreach.internal.outreach.SonatypeOutreach - Could not download page bundle
jvm 1 | org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
jvm 1 | 2018-01-17 14:27:47,710+0100 INFO [qtp1148931253-265708] admin com.sonatype.nexus.plugins.outreach.internal.outreach.SonatypeOutreach - Could not download page bundle
jvm 1 | org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
I tried to Upload another file with file sizw of 300MB, it works fine.
Is there any file size limit in the Nexus.
There is no filesize limit in Nexus itself. However there might be timeout issues, performance issues with the app or other issues with the underlying OS and filesystem.

Jbehave Maven Exception

I've integrated Jbehave test in Hudson as A Maven goal but whenever I run Test via Hudson-web-interface, I get following error
BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.609s
[INFO] Finished at: Mon Dec 03 15:08:52 2012
[INFO] Final Memory: 26M/81M
[INFO] ------------------------------------------------------------------------
[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with exception(s)
[INFO] o.h.m.e.h.MavenExecutionResultHandler - [1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jbehave:jbehave-maven-plugin:4.0-beta-2:run-stories-as-paths (run-stories-as-paths) on project ABCServices: Failed to run stories as paths
[DEBUG] Closing connection to remote
[ERROR] Failed to execute goal org.jbehave:jbehave-maven-plugin:4.0-beta-2:run-stories-as-paths (run-stories-as-paths) on project ABCServices:
Failed to run stories as paths: Story path '.svn/all-wcprops' not found by class loader EmbedderClassLoader[urls=[/Users/abc/.hudson/jobs/TestHudson/workspace/target/test-classes/, /Users/abc/.hudson/jobs/TestHudson/workspace/target/classes/, SSIOServicesClient-1.0-SNAPSHOT.jar, poi-3.8.jar, cxf-rt-frontend-jaxws-2.5.2.jar, xml-resolver-1.2.jar, asm-3.3.jar, cxf-api-2.5.2.jar, cxf-rt-core-2.5.2.jar, cxf-rt-bindings-soap-2.5.2.jar, cxf-tools-common-2.5.2.jar, cxf-rt-databinding-jaxb-2.5.2.jar, cxf-rt-bindings-xml-2.5.2.jar, cxf-rt-frontend-simple-2.5.2.jar, cxf-rt-ws-addr-2.5.2.jar, cxf-rt-transports-http-2.5.2.jar, cxf-rt-transports-common-2.5.2.jar, cxf-rt-frontend-jaxrs-2.5.0.jar, cxf-common-utilities-2.5.0.jar, jsr311-api-1.1.1.jar, jettison-1.3.jar, jaxb-api-2.1.jar, stax-api-1.0-2.jar, activation-1.1.jar, cxf-bundle-jaxrs-2.5.0.jar, xmlschema-core-2.0.1.jar, woodstox-core-asl-4.1.1.jar, stax2-api-3.1.1.jar, geronimo-stax-api_1.0_spec-1.0.1.jar, geronimo-annotation_1.0_spec-1.1.1.jar, neethi-3.0.1.jar, wsdl4j-1.6.2.jar, geronimo-activation_1.1_spec-1.1.jar, geronimo-javamail_1.4_spec-1.7.1.jar, aopalliance-1.0.jar, spring-asm-3.0.6.RELEASE.jar, commons-logging-1.1.1.jar, jetty-continuation-7.5.3.v20111011.jar, jetty-http-7.5.3.v20111011.jar, jetty-io-7.5.3.v20111011.jar, jetty-util-7.5.3.v20111011.jar, jetty-security-7.5.3.v20111011.jar, slf4j-api-1.6.2.jar, geronimo-servlet_2.5_spec-1.1.2.jar, log4j-1.2.16.jar, gson-1.7.1.jar, jaxb-impl-2.0.3.jar, jsr173_api-1.0.jar, testng-6.5.1.jar, junit-4.10.jar, hamcrest-core-1.1.jar, bsh-2.0b4.jar, jcommander-1.12.jar, snakeyaml-1.6.jar, spring-core-3.1.1.RELEASE.jar, spring-context-3.1.1.RELEASE.jar, spring-web-3.1.1.RELEASE.jar, spring-expression-3.1.1.RELEASE.jar, spring-beans-3.1.1.RELEASE.jar, spring-aop-3.1.1.RELEASE.jar, spring-context-support-3.1.1.RELEASE.jar, spring-tx-3.1.1.RELEASE.jar, spring-orm-3.1.1.RELEASE.jar, spring-jdbc-3.1.1.RELEASE.jar, spring-oxm-3.1.1.RELEASE.jar, commons-lang-2.5.jar, spring-test-3.1.1.RELEASE.jar, commons-httpclient-3.1.jar, commons-codec-1.2.jar, SharedshelfSchema-0.7.jar, xom-1.2.5.jar, xml-apis-1.3.03.jar, xercesImpl-2.8.0.jar, xalan-2.7.0.jar, json-lib-2.4-jdk15.jar, commons-beanutils-1.8.0.jar, commons-collections-3.2.1.jar, ezmorph-1.0.6.jar, VWWebServicesClient-1.0.jar, httpclient-4.2.1.jar, httpcore-4.2.1.jar, httpmime-4.0.1.jar, apache-mime4j-0.6.jar, json-20090211.jar, hibernate-entitymanager-3.5.6-Final.jar, hibernate-core-3.5.6-Final.jar, antlr-2.7.6.jar, dom4j-1.6.1.jar, jta-1.1.jar, hibernate-annotations-3.5.6-Final.jar, hibernate-commons-annotations-3.2.0.Final.jar, cglib-2.2.jar, javassist-3.9.0.GA.jar, hibernate-jpa-2.0-api-1.0.0.Final.jar, morphia-0.99.1-SNAPSHOT.jar, mongo-java-driver-2.10.0.jar, cglib-nodep-2.2.2.jar, jbehave-maven-plugin-4.0-beta-3.jar, jbehave-core-4.0-beta-3.jar, junit-dep-4.8.2.jar, hamcrest-library-1.1.jar, hamcrest-integration-1.1.jar, commons-io-1.4.jar, plexus-utils-2.0.5.jar, freemarker-2.3.16.jar, paranamer-2.4.jar, xstream-1.3.1.jar, xpp3_min-1.1.4c.jar, maven-plugin-api-2.0.11.jar, maven-artifact-2.0.11.jar, maven-project-2.0.11.jar, maven-settings-2.0.11.jar, maven-profile-2.0.11.jar, maven-model-2.0.11.jar, maven-artifact-manager-2.0.11.jar, maven-repository-metadata-2.0.11.jar, wagon-provider-api-1.0-beta-2.jar, maven-plugin-registry-2.0.11.jar, plexus-interpolation-1.1.jar, plexus-container-default-1.0-alpha-9-stable-1.jar, classworlds-1.1-alpha-2.jar, plexus-archiver-1.2.jar, plexus-io-1.0.1.jar, proxytoys-1.0.jar, tuprolog-extensions-2.1.1.jar, tuprolog-2.1.1.jar, xunit-1.9.jar, guice-2.0.1.jar, dtkit-metrics-model-0.8.jar, dtkit-metrics-util-0.8.jar, saxon-9.1.0.8.jar, saxon-9.1.0.8-s9api.jar, saxon-9.1.0.8-dom.jar, dtkit-metrics-hudson-api-0.8.jar, dtkit-junit-model-0.8.jar, dtkit-default-junit-hudson-0.9.jar, dtkit-default-junit-0.9.jar],parent=ClassRealm[plugin>org.jbehave:jbehave-maven-plugin:4.0-beta-2, parent: sun.misc.Launcher$AppClassLoader#5ab8df17]] -> [Help 1]
[ERROR]
Please tell me what should I do to resolve this issue.
PS: I am not using any Source Code Management.
I have figured out the issue.It happened because of the difference between Maven versions I integrated in Hudson and the version with which my application's pom working.
application was working with Maven2 and Hudson was working with Maven3, I configured hudson with Maven2 and it workd fine.

Resources