maven Failed to copy file for artifact

本文详细记录了解决Maven构建过程中因文件复制冲突导致错误的步骤和解决方案,涉及项目配置、仓库管理及避免重复依赖等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

hile building project: maven install,maven package,maven war:inplace

在做项目过程中经常出现类似以下的错误,记下来备忘。

 

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.taobao.lifeuser:lifeuser-server:war:1.0.0-SNAPSHOT
[INFO] 
[INFO] Id: com.taobao.lifeuser:lifeuser-server:war:1.0.0-SNAPSHOT
[INFO] task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: E:\dev\workspace\lifeuser\lifeuser-server\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
There are no tests to run.

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] [war:war]
[INFO] Packaging webapp
[INFO] Assembling webapp[lifeuser-server] in [E:\dev\workspace\lifeuser\lifeuser-server\target\lifeuser-server-1.0.0-SNAPSHOT]
[INFO] Processing war project
[ERROR] 

The following mojo encountered an error while executing:
Group-Id: org.apache.maven.plugins
Artifact-Id: maven-war-plugin
Version: 2.1-alpha-1
Mojo: war
brought in via: packaging: war

While building project:
Group-Id: com.taobao.lifeuser
Artifact-Id: lifeuser-server
Version: 1.0.0-SNAPSHOT
From file: E:\dev\workspace\lifeuser\lifeuser-server\pom.xml
Reason: Failed to copy file for artifact[com.taobao.lifeuser:lifeuser-core:jar:1.0.0-SNAPSHOT:compile]



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run with the -e flag
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILED
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Thu Dec 22 14:22:50 CST 2011
[INFO] Final Memory: 2M/10M
[INFO] ------------------------------------------------------------------------

 

    Reason: Failed to copy file for artifact[com.taobao.lifeuser:lifeuser-core:jar:1.0.0-SNAPSHOT:compile]

 

    错误原因:需要操作本次仓库中lifeuser-core.jar这个包,而在本地的workspace已经有一个lifeuser-core工程,此工程中也有一份lifeuser-core.jar包,导致出错.

 

    解决方案:先将lifeuser-core这工程关掉,然后再去maven war:inplace(install、package),就不会有问题了。

 

 

[WARNING] [WARNING] Some problems were encountered while building the effective model for com.hw:asset:jar:1.0.0 [WARNING] 'dependencies.dependency.systemPath' for com.huawei.gauss:com.huawei.gauss.jdbc.ZenithDriver:jar should not point at files within the project directory, ${project.basedir}/lib/gaussdbv3.jdbc-V300R001C00CP2075.jar will be unresolvable by dependent projects @ line 45, column 25 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ----------------------------< com.hw:asset >---------------------------- [INFO] Building asset 1.0.0 [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- resources:3.2.0:resources (default-resources) @ asset --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Using 'UTF-8' encoding to copy filtered properties files. [INFO] Copying 3 resources [INFO] Copying 0 resource [INFO] [INFO] --- compiler:3.10.1:compile (default-compile) @ asset --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.071 s [INFO] Finished at: 2025-07-16T10:46:59+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project asset: Resolution of annotationProcessorPath dependencies failed: For artifact {org.projectlombok:lombok:null:jar}: The version cannot be empty. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
最新发布
07-17
在使用Kotlin编程语言时,有可能会遇到无法下载Kotlin编译器Maven构件的问题。这意味着无法从Maven仓库中获得所需的Kotlin编译器版本。 出现这个问题的原因可能有以下几种: 1. 没有正确配置Maven仓库:当使用Maven进行项目构建时,需要将正确的Maven仓库配置添加到项目的pom.xml文件中。如果没有正确配置Maven仓库,Maven将无法从仓库中获取任何构件。 2. Maven仓库镜像问题:有时候,我们可能会使用Maven仓库的镜像来加快依赖的下载速度。但是,如果镜像配置不正确或者镜像服务器无法提供所需构件,就会导致下载失败。 解决这个问题的方法如下: 1. 检查并修复Maven仓库配置:打开项目的pom.xml文件,确保已正确配置了Maven仓库。可以参考Maven官方文档或其他可靠来源了解正确的配置方法。 2. 检查并更换Maven仓库镜像:如果使用了镜像,并且下载失败,可以尝试更换其他可用的镜像。可以在Maven官方网站找到可用的镜像列表,并将合适的镜像地址添加到pom.xml文件中。 3. 手动下载并安装Kotlin编译器:如果无法通过Maven仓库下载Kotlin编译器,可以考虑手动下载所需的Kotlin编译器构件,并将其安装到本地的Maven仓库中。在Maven仓库中手动安装构件之后,就可以通过Maven进行依赖引入了。 总之,解决"failed to download kotlin compiler maven artifact"问题的关键是正确配置Maven仓库和镜像,或者手动安装所需构件。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值