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
Related
[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
I have uploaded manually an maven dependency to my artifact repository
From my local PC, "mvn install" download correctly every maven dependency from the artifact repository, included my manually uploaded dependency.
mvn -U clean install -DskipTests=true
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.healthcentrix.prevvy:frontend >------------------
[INFO] Building frontend 2.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from cloud-artifacts: artifactregistry://us-central1-maven.pkg.dev/prevvy1/artifacts/org/moxieapps/gwt/highcharts/1.7.2/highcharts-1.7.2.pom
Downloaded from cloud-artifacts: artifactregistry://us-central1-maven.pkg.dev/prevvy1/artifacts/org/moxieapps/gwt/highcharts/1.7.2/highcharts-1.7.2.pom (401 B at 90 B/s)
Downloading from cloud-artifacts: artifactregistry://us-central1-maven.pkg.dev/prevvy1/artifacts/org/moxieapps/gwt/highcharts/1.7.2/highcharts-1.7.2.jar
Downloaded from cloud-artifacts: artifactregistry://us-central1-maven.pkg.dev/prevvy1/artifacts/org/moxieapps/gwt/highcharts/1.7.2/highcharts-1.7.2.jar (521 kB at 376 kB/s)
From Cloud Build or cloud-build-local, we got an permission error
[ERROR] Failed to execute goal on project frontend: Could not resolve dependencies for project com.healthcentrix.prevvy:frontend:jar:2.1-SNAPSHOT:
Failed to collect dependencies at org.moxieapps.gwt:highcharts:jar:1.7.2:
Failed to read artifact descriptor for org.moxieapps.gwt:highcharts:jar:1.7.2:
Could not transfer artifact org.moxieapps.gwt:highcharts:pom:1.7.2 from/to cloud-artifacts (artifactregistry://us-central1-maven.pkg.dev/prevvy1/artifacts):
Permission denied on remote repository (or it may not exist).
The request had no credentials because none were available from the environment.
Ensure that either 1) You are logged into gcloud or 2) Application default credentials are setup (see https://developers.google.com/accounts/docs/application-default-credentials for more information). 403 Forbidden
Step #0: [builder] [ERROR] {"error":"Permission "artifactregistry.repositories.downloadArtifacts" denied on resource "projects/prevvy1/locations/us-central1/repositories/artifacts" (or it may not exist)"}
Our Cloud build Project service account has every Artifact Registry permission, and is downloading the rest of depedencies excluding this specific artifact, which was uploaded manually
is necessary to give some specific permissions to this specific artifact? how?
Thanks in advance for any guidance
Regards
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?
getting this error when trying to maven install
Failed to execute goal
org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar (default-jar) on
project AbacusLibraryServer: Execution default-jar of goal
org.apache.maven.plugins:maven-jar-plugin:3.1.2:jar failed: Plugin
org.apache.maven.plugins:maven-jar-plugin:3.1.2 or one of its
dependencies could not be resolved: Failed to collect dependencies at
org.apache.maven.plugins:maven-jar-plugin:jar:3.1.2 ->
org.apache.maven.shared:file-management:jar:3.0.0: Failed to read
artifact descriptor for
org.apache.maven.shared:file-management:jar:3.0.0: Could not transfer
artifact org.apache.maven.shared:file-management:pom:3.0.0 from/to
central (https://repo.maven.apache.org/maven2): Transfer failed for
https://repo.maven.apache.org/maven2/org/apache/maven/shared/file-management/3.0.0/file-management-3.0.0.pom:
Received fatal alert: protocol_version -> [Help 1]
i can see a lot of .lastUpdated files in maven.
tried using maven clean and then maven install.
i tried deleting all these files and doing maven force update using eclipse not working.
what is working is downloading every jar file one by one from maven repository already done for around 20 but there are still more and no idea how much isn't there a easier way.
also not using any proxy tried using mobile network and personal wifi.
The dependencies already be available in both local and server, but maven build(clean, install) still failed and complain that can't find them.
1> Although the dependency can be found in server, but failed to build online
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/aspectj-maven-plugin/1.4/aspectj-maven-plugin-1.4.pom
[WARNING] Unable to get resource 'org.codehaus.mojo:aspectj-maven-plugin:pom:1.4' from repository central (http://repo1.maven.org/maven2): (http://repo1.maven.org/maven2%29:) Authorization failed: Access denied to: h
ttp://repo1.maven.org/maven2/org/codehaus/mojo/aspectj-maven-plugin/1.4/aspectj-maven-plugin-1.4.pom
2> I try to try offline, as the dependency is already in local, but failed
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
GroupId: org.codehaus.mojo
ArtifactId: aspectj-maven-plugin
Version: 1.4
Reason: System is offline.
org.codehaus.mojo:aspectj-maven-plugin:pom:1.4
3> BTW, i have configured the relevant profile for the server
You're likely behind a proxy that needs authentication.
To run Maven in offline mode do mvn -o clean install