"MVN清洁生成源"无法解决依赖关系 [英] "mvn clean generate-sources" could not resolve dependencies
问题描述
有
我遇到了一个奇怪的问题.我有一个在Maven中构建的多模块企业项目.我这样设置项目层次结构
I met a weird problem. I have a multi-modules enterprise project that is built in Maven. I setup the project hierarchy like this
parentPom
--MyEar (packaging ear)
--MyUtilJar (packaging jar)
--MyEJB (packing ejb)
--MyWeb (packaging war)
在MyEJB项目中,pom.xml
实际上将apt插件绑定到generate-sources阶段以生成一些Java代码. MyEJB依赖于MyUtilJar项目.
In the MyEJB project, the pom.xml
actually binds the apt plugin to the generate-sources phase to generate some java codes. MyEJB depends on MyUtilJar project.
我的问题是,当我执行mvn clean编译时,一切正常.但是,如果我改为执行mvn clean generate-sources,则会引发错误,抱怨它无法解决工件mygroup:MyUtilJar:jar:1.0
的依赖性.
My problem is that when I execute the mvn clean compile, everything works fine. But if I execute mvn clean generate-sources instead, it throws error, complaining it cannot resolve dependency for artifact mygroup:MyUtilJar:jar:1.0
.
如何解决此问题?
推荐答案
为了使generate-sources正常工作,您需要在存储库中拥有所有依赖项-您的本地依赖项或远程依赖项.只是将依赖项放在需要的位置附近的文件夹中是行不通的.
In order for the generate-sources to work, you need to have all dependencies in a repository - your local one or a remote one. Just having the dependency in a folder near where it's needed won't work.
尝试构建和安装直到将其放入本地存储库中,然后运行generate-sources.
Try building and installing the until to put it in your local repository then running the generate-sources.
这篇关于"MVN清洁生成源"无法解决依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!