我只使用maven进行最简单的配置:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.app.myApp.my-dependencies</groupId>
<artifactId>this-dependency</artifactId>
<version>0.0.1</version>
<distributionManagement>
<snapshotRepository>
<id>mySnapshotsLocal</id>
<name>my-snapshot-local</name>
<url>http://maven.myRepo/artifactory/my-snapshot-local</url>
</snapshotRepository>
<repository>
<id>myLocal</id>
<name>my-release-local</name>
<url>http://maven.myRepo/artifactory/my-release-local</url>
</repository>
</distributionManagement>
我尝试使用
mvn deploy
命令将依赖项上传到Artifactory,这很有效,但是当我在文件中进行更改并再次运行命令时,它给了我:
org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact
: Resource to deploy not found: File: http://maven.myRepo/artifactory/my-release-local
/com/app/myApp/my-dependencies/this-dependency
0.0.1/dependency-0.0.1.jar does not exist
这是否意味着mvn deploy无法处理替换现有依赖项?在我看来,这个命令只适用于一次......
这是完整的堆栈跟踪
[INFO] [deploy:deploy {execution: default-deploy}]
Uploading: http://maven.myRepo/artifactory/my-release-local/com/app/myApp/my-dependencies/this-dependency0.0.1-/dependency-0.0.1.jar
4/30K
8/30K
12/30K
16/30K
20/30K
24/30K
28/30K
30/30K
[INFO]------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error deploying artifact: Resource to deploy not found: File: http://maven.myRepo/artifactory/my-release-local/com/app/myApp/my-dependencies/this-dependency0.0.1-/dependency-0.0.1.jar does not exist
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact: Resource to deploy not found: File:
org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact: Resource to deploy not found: File: http://maven.myRepo/artifactory/my-release-local/com/app/myApp/my-dependencies/this-dependency0.0.1-/dependency-0.0.1.jar does not exist
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error deploying artifact: Resource to deploy not found: File: http://maven.myRepo/artifactory/my-release-local/com/app/myApp/my-dependencies/this-dependency0.0.1-/dependency-0.0.1.jar does not exist
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:195)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error deploying artifact: Resource to deploy not found: File: http://maven.myRepo/artifactory/my-release-local/com/app/myApp/my-dependencies/this-dependency0.0.1-/dependency-0.0.1.jar does not exist
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:121)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:173)
... 19 more
Caused by: org.apache.maven.wagon.TransferFailedException: Resource to deploy not found: File: http://maven.myRepo/artifactory/my-release-local/com/app/myApp/my-dependencies/this-dependency0.0.1-/dependency-0.0.1.jar does not exist
at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:356)
at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:227)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:107)
... 20 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: File: http://maven.myRepo/artifactory/my-release-local/com/app/myApp/my-dependencies/this-dependency0.0.1-/dependency-0.0.1.jar does not exist
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.finishPutTransfer(LightweightHttpWagon.java:200)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:413)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:392)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:365)
at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:163)
at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:317)
... 22 more