[JAVA] Set the source of the library set as a dependency in IntelliJ as a separate module of the project

For example, suppose you have a repository called ʻA and you have a library called ʻauth-shared that is commonly used by multiple projects set as a dependency.

If you normally open a repository called ʻA in IntelliJ, ʻauth-shared will be imported as an external library, and if you want to modify ʻauth-shared, open the ʻauth-shared project, modify it, andmaven install You have to do something likeand reload with ʻA`, which is inconvenient when you want to fix it frequently or when you want to make trial and error.

By the method described below, in such a case, you can open ʻA and ʻauth-shared in the same project, and as soon as you modify ʻauth-shared`, you can see the modified behavior.

procedure

Add the local source of the dependent library as a module to your project

From the IntelliJ menu "File"-> "Module from Existing Sources ...", select the root directory of the module you want to add to your project or pom.xml for Maven.

Set Dependencies from Project Structure

Project Structure-> Modules-> Select Dependent Modules-> Dependencies tab-> Press "Module Dependency" from the "+" button to add it as a dependency.

The upper part of the list of Dependencies is referred to preferentially, so move the added dependency to a position higher than the original dependency (on Mac, it is easy to move it with ʻOption + ↑ `).

Recommended Posts

Set the source of the library set as a dependency in IntelliJ as a separate module of the project
How to set BuildConfig of library project (module) to Debug
Check the dependency of a specific maven artifact in Coursier
How to change the value of a variable at a breakpoint in intelliJ
I tried the AutoValue library in Intellij
Define a task to ZIP archive a set of project files in Gradle
Set up a Java GUI in a separate thread to keep the main
(Note) Get a set of dependent library jars with the help of Gradle
Get the path defined in Controller class of Spring boot as a list
Let's refer to C ++ in the module of AndroidStudio other project (Java / kotlin)
[Order method] Set the order of data in Rails
Measure the size of a folder in Java
Set the time of LocalDateTime to a specific time
[Rails] I want to display the link destination of link_to in a separate tab
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
Prepare the execution environment of Tomcat in IntelliJ Community
[CentOS, Eclipse] Load a library file in a C project
How to create a Spring Boot project in IntelliJ
[Java] When writing the source ... A memorandum of understanding ①
Display the average value of the evaluation as a star
Set the root URL when starting tomcat in intelliJ
Set the maximum number of characters in UITextField in RxSwift
When I switched to IntelliJ, I got a lot of differences in the encoding of the properties file.
I tried using the GitHub repository as a library server
A quick explanation of the five types of static in Java
Determine that the value is a multiple of 〇 in Ruby
Setting the baseURL in the axios module of Docker environment Nuxt
Set the time zone in the JVM of your Azure application
A program that counts the number of words in a List
Find the number of days in a month with Kotlin