Reputation: 2291
I have 3 java 8 gradle projects, A,B,C. A and C depends on B. A and C are not connected with each other directly. 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? Change B, compile jar, copy jar, test 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.
Upvotes: 1
Views: 35
Reputation: 5932
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. 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). The goal is to have modules A, B and C part of your project:
You can press the +
button at the top to 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.)
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
. If the JAR file for the depending module is also still in the list, remove it.
Now press OK and trigger a rebuild of your project (Build > Rebuild Project
). If everything compiles, you can now make code changes anywhere or even debug all three modules at the same time.
Upvotes: 1