[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project maven-web-application: Failed to deploy artifacts: Could not transfer artifact com.mt:maven-web-application:war:2.0.7-20230110.202313-1 from/to nexus (http://172.31.7.102:8081/repository/maven-snapshots/): authentication failed for http://172.31.7.102:8081/repository/maven-snapshots/com/mt/maven-web-application/2.0.7-SNAPSHOT/maven-web-application-2.0.7-20230110.202313-1.war, status: 401 Unauthorized
I have double-checked my distribution management on my Pom file and settings.xml on both jenkins and maven and everything is 100% fine. It builds successfully on my local server but won't build on my jenkins pipeline. I have been on this issue for the last 4 days. I need help
I have double-checked my distribution management on my Pom file and settings.xml on both jenkins and maven and everything is 100% fine. It builds successfully on my local server but won't build on my jenkins pipeline. I have been on this issue for the last 4 days. please, I need help
Related
I have one project that uses the git runner.
The command mvn package works fine on local, all dependencies are downloaded from my local nexus.
When I execute build command at the git runner environment, all dependencies from my local nexus where downloaded without problem too, but only one dependency is a problem, lets see:
[ERROR] Failed to execute goal on project sic: Could not resolve dependencies for project com.example:sic:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at br.com.sspds:ojdbc6:jar:1.0.1: Failed to read artifact descriptor for br.com.sspds:ojdbc6:jar:1.0.1: Could not transfer artifact br.com.sspds:ojdbc6:pom:1.0.1 from/to Nexus (http://172.25.100.75:8090/repository/maven-public/): Transfer failed for http://172.25.100.75:8090/repository/maven-public/br/com/sspds/ojdbc6/1.0.1/ojdbc6-1.0.1.pom: No route to host (Host unreachable)
One big detail: the library ojdbc6-1.0.1.jar was developed by our team and made available manually on our nexus server.
My configuration from nexus server is into my pom.xml.
Any idea about this problem?
I use Jenkins to build a Maven project.
I have the Jenkins Credentials Plugin and the Jenkins Artifactory Plugin.
I have added my Artifactory credentials in the Credentials config.
I have configured the Artifactory plugin to use the Credentials and have set up the server URL. Test Connection works and reports back that it has found the server.
My project's POM specifies the correct Artifactory paths for the repository and the snapshotsRepository in the distributionManagement section.
My Jenkins project build is configured to do a mvn deploy.
In my local build, from my development machine, I can deploy to the Artifactory server (I have configured the credentials in my settings.xml.
However, in my Jenkins job, I want to use the Artifactory plugin and the Credentials int he Credentials plugin. When I build, I get the following
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://xxxxx/artifactory/libs-release-local
Uploading: http://xxxxx/artifactory/libs-release-local/xxx/3.01/xxx-3.01.war
Uploading: http://xxxxx/artifactory/libs-release-local/xxx/3.01/xxx-3.01.pom
Notifying upstream projects of job completion
Join notifier requires a CauseAction
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
and the following stack trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project querynator:
Failed to deploy artifacts: Could not transfer artifact xxx:war:3.01 from/to dwCentral (http://xxxxx/artifactory/libs-release-local):
Failed to transfer file: http://xxxxx/artifactory/libs-release-local/xxx/3.01/xxx-3.01.war.
Return code is: 401, ReasonPhrase: .
This indicates to me the issue is with credentials, particularly since I can deploy from my dev box (using credentials in settings.xml), but not from Jenkins.
I have tried deploying a new version. I have tried deploying snapshots. This is not a version issue.
How can I I resolve this? How can I troubleshoot this further?
When using the Artifactory plugin in Jenkins, you should not use mvn deploy in the main build task. That uses the Maven Deploy Plugin, and hence will try to use credentials stored in the settings.xml file.
Instead, use mvn install as the main build task, and set up a new post-build task to Deploy Artifact to Repository.
This allows you to define the server, repository locations, and credentials to use.
Assuming you have already configured the credentials properly. If you have already deployed version lets say x.y.z to the artifactory once. Executing the command
mvn deploy
again for the same version would also result in the
Return code is: 401, ReasonPhrase: Unauthorized.
You can try updating the version to x.y.a which has never been deployed, the job should just run fine.
More from the documentation at Maven Lifecycle Basics
deploy - done in the build environment, copies the final package to
the remote repository for sharing with other developers and projects.
and assuming that you understand What exactly is a Maven Snapshot and why do we need it? and agree upon the fact that once a project is shared across things shouldn't be changing on the fly for consumers, the deploy phase is not permitted for the same version more than once.
I'm trying to deploy a Maven jar to S3 from within IntelliJ (meaning, using the Maven Projects panel). This fails constantly, saying:
Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MyProject: Failed to deploy artifacts: Could not transfer artifact Project:MyProject:jar:1.0.0 from/to s3-spark.release (s3://MyS3): Unable to load AWS credentials from any provider in the chain -> [Help 1]
But, when I try to do the same from within the terminal using mvn deploy, everything works great. Any ideas what am I missing? (Using Maven 3.3.9, IntelliJ Comumnity 2016.1)
I am using the tycho-p2-publisher-plugin in order to create a p2 site which can be uploaded to Nexus as described at Tool for managing/hosting own p2 repositories? - it aimed to be a work-around for the fact that Nexus does not seem to support hosted p2 repositories.
My problem is: the p2 artifacts are created fine and are even uploaded to Nexus whenever I do a snapshot build. However, when I try a release build, the build fails because of
[INFO] INFORMATION: I/O exception (java.io.FileNotFoundException) caught when processing request: /home/hudson/jobs/jobname/workspace/our.component.build/target/checkout/our.component.repository/target/p2content.xml
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project our.component.repository: Failed to deploy artifacts: Could not transfer artifact our.component:our.component.repository:xml:p2metadata:1.1.18 from/to releases (http://192.168.205.205:8081/nexus/content/repositories/releases): /home/hudson/jobs/jobname/workspace/thirdparty/our.component.build/target/checkout/our.component.repository/target/p2content.xml (Datei oder Verzeichnis nicht gefunden) -> [Help 1]
p2content.xml is not found, simply because it's not there. The question is, should it be there?
I am using the maven release plugin, and as far as I understand, during the release build process, all components are prepared, then checked in and tagged with the release version. After that, they are checked back out from the tag, and then the build is started. As obviously the release build is run for the checkout folder (as seen above: .../target/checkout/...), the problem seems to be that p2context.xml is created by the tycho-p2-publisher-plugin during the build, but not checked in, while later it is expected to appear in the checkout folder. I would guess that Maven should not expect the file there and try to deploy it to Nexus, but I fail to understand why is it expected to be there? And what's the right approach to cure my release build?
I'm trying to deploy my artifacts to my local maven repository, but I keep running into issues. I have a Post-build Action defined to deploy my artifact to the following url: file:///home/nick/.m2/repository/ but I keep getting the following failed build message:
[JENKINS] Archiving /var/lib/jenkins/workspace/ouPerson/pom.xml to edu.oakland.ouPerson/ouPerson/0.2.0/ouPerson-0.2.0.pom
[JENKINS] Archiving /var/lib/jenkins/workspace/ouPerson/target/ouPerson-0.2.0.jar to edu.oakland.ouPerson/ouPerson/0.2.0/ouPerson-0.2.0.jar
channel stopped
Maven RedeployPublisher use remote maven settings from : /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/_home_nick_bin_maven/conf/settings.xml
[INFO] Deployment in file:///home/nick/.m2/repository/ (id=ouPerson,uniqueVersion=true)
Deploying the main artifact ouPerson-0.2.0.jar
Uploading: file:///home/nick/.m2/repository/edu/oakland/ouPerson/ouPerson/0.2.0/ouPerson-0.2.0.jar
Uploading: file:///home/nick/.m2/repository/edu/oakland/ouPerson/ouPerson/0.2.0/ouPerson-0.2.0.pom
ERROR: Failed to deploy artifacts: Could not transfer artifact edu.oakland.ouPerson:ouPerson:jar:0.2.0 from/to ouPerson (file:///home/nick/.m2/repository/): Specified destination directory cannot be created: /home/nick/.m2/repository/edu/oakland/ouPerson/ouPerson/0.2.0
org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact edu.oakland.ouPerson:ouPerson:jar:0.2.0 from/to ouPerson (file:///home/nick/.m2/repository/): Specified destination directory cannot be created: /home/nick/.m2/repository/edu/oakland/ouPerson/ouPerson/0.2.0
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:143)
at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:193)
at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:176)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:756)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1040)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:669)
at hudson.model.Run.execute(Run.java:1735)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:234)
Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact edu.oakland.ouPerson:ouPerson:jar:0.2.0 from/to ouPerson (file:///home/nick/.m2/repository/): Specified destination directory cannot be created: /home/nick/.m2/repository/edu/oakland/ouPerson/ouPerson/0.2.0
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:341)
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:269)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:413)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:139)
... 11 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact edu.oakland.ouPerson:ouPerson:jar:0.2.0 from/to ouPerson (file:///home/nick/.m2/repository/): Specified destination directory cannot be created: /home/nick/.m2/repository/edu/oakland/ouPerson/ouPerson/0.2.0
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1016)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1004)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:895)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:522)
at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:335)
... 14 more
Caused by: org.apache.maven.wagon.TransferFailedException: Specified destination directory cannot be created: /home/nick/.m2/repository/edu/oakland/ouPerson/ouPerson/0.2.0
at org.apache.maven.wagon.AbstractWagon.createParentDirectories(AbstractWagon.java:264)
at org.apache.maven.wagon.providers.file.FileWagon.fillOutputData(FileWagon.java:100)
at org.apache.maven.wagon.StreamWagon.getOutputStream(StreamWagon.java:188)
at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:159)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:871)
... 16 more
[INFO] Deployment failed after 0.13 sec
Build step 'Deploy artifacts to Maven repository' changed build result to FAILURE
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: FAILURE
Any ideas what I may be missing?
Ok, I figured out the reason why it wasn't working. I originally installed maven via apt-get, however after having issues deploying, I decided to download the war file on jenkins website and dropped the war into $TOMCAT_HOME/webapps and then I was able to deploy to local maven repository without any issues. Hope that helps those that are having similar issues!
try
mvn install
This will install your artifact to your LOCAL maven repo.
If you build your Jenkins job with maven, you have Top-Maven Target. Add this to your job with goals
clean install
Don't forget add pom.xml in advance