我在修改 Intellij12.04 中的依赖项时遇到问题。
在我的项目文件夹下,我有两个模块,其中第二个依赖于第一个:
---> a.b.c.tests
我想从 a.b.c.tests 中删除一个依赖项并将其添加到 a.b.c.somebusiness 模块中,但我不想创建一个循环依赖项树。当我尝试从 a.b.c.tests 模块中删除依赖项并将其添加到 a.b.c.somebusiness 模块中时,我收到以下错误:
"源根目录 "C:\Perforce\depot\Projest\Main\a.b.c.tests\src\test"不能在模块 "Main"中定义,因为它属于嵌套模块 "a.b.c.tests"的内容"
我不知道该怎么做才能解决这个问题。谁能建议一种方法来解决我收到的错误?
最佳答案
你应该看看使用 apache maven
和项目对象模型(pom.xml
文件)
当您在 <dependencies>
下定义依赖项时在 pom.xml 中,它们由 IntelliJ 自动管理。因此,手动将依赖项移动到文件夹中,您将永远不会遇到此类问题。
如果您按照如下所示的方式对其进行配置,您的依赖项将自动运行。
<dependencies>
<dependency>
<groupId>a.b.c</groupId>
<artifactId>a-b-c-tests</artifactId>
</dependency>
<dependency>
<groupId>some.other.org</groupId>
<artifactId>some.other.dep</artifactId>
</dependency>
</dependencies>
如何开始:安装 apache maven 并在项目的根目录添加 pom.xml。右键单击它以将其添加为 IntelliJ 中的 maven 文件。
祝你好运!
关于intellij-idea - Intellij idea 12.0.4 中的依赖管理问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15909816/