简体   繁体   English

Jenkins部署到本地Maven存储库

[英]Jenkins Deploying to local maven repository

I'm trying to deploy my artifacts to my local maven repository, but I keep running into issues. 我正在尝试将我的工件部署到我的本地Maven存储库中,但是我一直遇到问题。 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: 我定义了一个Post-build Action以将我的工件部署到以下URL: file:///home/nick/.m2/repository/但我不断收到以下失败的构建消息:

[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. 我最初是通过apt-get安装maven的,但是在部署了问题之后,我决定将war文件下载到jenkins网站上 ,并将该war放到$TOMCAT_HOME/webapps ,然后我便可以部署到本地maven存储库而没有任何问题。 Hope that helps those that are having similar issues! 希望对那些有类似问题的人有所帮助!

try 尝试
mvn install
This will install your artifact to your LOCAL maven repo. 这会将您的工件安装到本地Maven存储库中。
If you build your Jenkins job with maven, you have Top-Maven Target. 如果您使用Maven构建Jenkins职位,那么您将拥有Top-Maven Target。 Add this to your job with goals 将此目标添加到您的工作中
clean install
Don't forget add pom.xml in advance 不要忘记预先添加pom.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM