简体   繁体   English

IntelliJ IDEA:处理项目及其依赖项的最佳方法

[英]IntelliJ IDEA: Best way to work on a project and on its dependency

I am working on a main project that depends on dbunit . 我正在开发一个依赖dbunit的主要项目。 dbunit is defined as a dependency in the Maven pom. dbunit在Maven pom中定义为依赖项。 It works find, but I found a bug in dbunit and would like to fix it. 它可以找到,但是我在dbunit中发现了一个错误,想修复它。

Now, I download the source code of dbunit. 现在,我下载dbunit的源代码。 How can I instructs IntelliJ IDEA and Maven to use that code instead of the maven dependency? 如何指示IntelliJ IDEA和Maven使用该代码而不是maven依赖项? Note that my project use subversion, dbunit uses git. 请注意,我的项目使用subversion,dbunit使用git。 My project si Java 1.8 based, dbunit is Java 1.5. 我的项目基于Java 1.8,而dbunit是Java 1.5。

Ideally, I want to be able to simply change the code in dbunit and the hit the compile button in my project, and everything gets compiled and running. 理想情况下,我希望能够简单地更改dbunit中的代码并在项目中单击“编译”按钮,然后一切都将被编译并运行。 I could also debug within my code and then fall into's dbunit's code. 我还可以在代码中进行调试,然后使用dbunit的代码。

I have wasted an hour trying to import dbunit as a module, but to no vail. 我浪费了一个小时尝试将dbunit作为模块导入,但是没有任何效果。 dbunit has a parent in the pom.xml that does not correspond to my project and it must remain as such. dbunit在pom.xml中有一个与我的项目不对应的父项,因此必须保持原样。

So what is the best possible setup to work on both project, one depending on the other? 那么,在两个项目上都能使用的最佳设置是什么,一个取决于另一个?

You need to import both projects (as modules) into a single IntelliJ project. 您需要将两个项目(作为模块)导入到单个IntelliJ项目中。

If you run your code by IntelliJ (but not by using Maven goals), it will use the dbunit module, instead of using the artifact in your repository. 如果您通过IntelliJ(而不是通过使用Maven目标)运行代码,则它将使用dbunit模块,而不是在存储库中使用工件。

Modules in your IntelliJ projects can be completely unrelated, it does not matter which parents they have. 您的IntelliJ项目中的模块可以完全不相关,无论它们拥有哪个父级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM