Jenkins部署到本地maven存储库

时间:2014-06-13 18:18:39

标签: maven jenkins

我试图将我的工件部署到我的本地maven存储库,但我一直遇到问题。我定义了Post-build Action以将我的工件部署到以下网址: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

我可能缺少什么想法?

2 个答案:

答案 0 :(得分:0)

好的,我弄清楚它无法正常工作的原因。我最初通过apt-get安装了maven,但是在部署问题后,我决定在jenkins website上下载war文件并将war放入$TOMCAT_HOME/webapps然后我能够毫无问题地部署到本地maven存储库。希望能帮助那些有类似问题的人!

答案 1 :(得分:0)

试试 mvn install
这会将您的工件安装到您的LOCAL maven repo。
如果使用maven构建Jenkins作业,则可以使用Top-Maven Target。将此添加到您的工作目标中 clean install
不要忘记提前添加pom.xml