简体   繁体   English

3个项目的intellijidea调试系统

[英]intellijidea debug system of 3 projects

I have 3 java 8 gradle projects, A,B,C. 我有3个Java 8 gradle项目,A,B,C。 A and C depends on B. A and C are not connected with each other directly. A和C取决于B。A和C不直接相互连接。 I want to debug my changes for project B and see how project A reacts on my changes for project B. How to debug iе in intellijidea? 我想调试项目B的更改,并查看项目A对项目B的更改有何反应。如何在intellijidea中调试i? Change B, compile jar, copy jar, test A? 更改B,编译jar,复制jar,测试A? It`s really boring and wrong, how to do it? 真的很无聊,怎么做?

UPDATE: Those 3 projects needs to be separated, because different people working on them. 更新:这三个项目需要分开,因为从事这些工作的人不同。

The easiest way is to configure your Module dependencies for A and C to directly use the source of B. This allows you to debug code in A, B and C at the same time without requiring a JAR to be build. 最简单的方法是将A和C的模块依赖性配置为直接使用B的源。这使您可以在A,B和C中同时调试代码,而无需构建JAR。 See the screenshots below for a step by step process. 请参阅下面的屏幕截图,以获取逐步的过程。

First of all, open a project and go to the Project Structure (CTRL+ALT+SHIFT+S). 首先,打开一个项目并转到项目结构(CTRL + ALT + SHIFT + S)。 The goal is to have modules A, B and C part of your project: 目标是在项目中包含模块A,B和C:

在此处输入图片说明

You can press the + button at the top to Import Module . 您可以按顶部的+按钮Import Module (Depending on whether you already have modules set up for these other projects, you might need to select New Module or Gradle instead.) (取决于是否已经为其他项目设置了模块,您可能需要选择“ New Module或“ Gradle 。)

Once you have the three modules in there, you should update their dependencies so it looks like the image below. 一旦有了三个模块,就应该更新它们的依赖关系,如下图所示。 Here you can see module C having a dependency on module B. To add such a dependency, click the + sign to the right of the list of dependencies and select Module Dependency . 在这里,您可以看到模块C对模块B有依赖性。要添加此类依赖性,请单击依赖性列表右侧的+号,然后选择Module Dependency If the JAR file for the depending module is also still in the list, remove it. 如果依赖模块的JAR文件也仍在列表中,请将其删除。

在此处输入图片说明

Now press OK and trigger a rebuild of your project ( Build > Rebuild Project ). 现在,按OK并触发项目的重建( Build > Rebuild Project )。 If everything compiles, you can now make code changes anywhere or even debug all three modules at the same time. 如果一切都能编译,您现在可以在任何地方进行代码更改,甚至可以同时调试所有三个模块。

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

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