0

How can I make changes to a library that exists as separate intellij project and is included as maven lib?

Project structure:

/IdeaProjects/mycommons/
/IdeaProjects/mycore/

mycore pom.xml:

<dependency>
    <groupId>my.domain</groupId>
    <artifactId>my-commons</artifactId>
    <version>1.0.0</version>
</dependency>

Now, if I have the /mycore project open, and go into a class from mycommons, there are two issues: 1. I only the the decompiled .class file. I would expect to see the real java file. 2. I cannot edit this file. If I want to change anything, I have to open the mycommons project in a different idea window. 3. If I run the mycore after changes in mycommons, those changes are not automatically picked up. I first have to run mvn install on the mycommons, then they are found in the core project.

Coming from eclipse, none of these points have been an issue. Eclipse just recognized that included libraries are themselves eclipse project. So I could edit them all in one window, and run the changes without having to mvn install the libraries on each change explicit.

How can I achieve the same behaviour in Intellij IDEA?

0

2 Answers 2

0

Have a single IntelliJ project with both modules (mycore and commons). Same as Eclipse would have a single workspace with them.

Sign up to request clarification or add additional context in comments.

4 Comments

I want to share the commons among all future company projects. So I cannot group the commons lib.
@membersound I meant IntelliJ project and modules, that is distinct from Maven...
Could you be more specific on what you mean? Currently I have two normal intellij projects, which means: different workspaces. If I would now copy the commons lib from one workspace into the other, it would only be available inside this core workspace. But ideally I'd like it being available in any workspace/project.
You can use the same module in multiple IntelliJ IDEA projects, import the module from the same location via the existing .iml file in another projects, simple as that.
0

Found the solution here: IntelliJ: Working on multiple projects

In "Maven Projects" tab, just click the green "+" button and add any existing commons projects pom.xml.

They then appear inside the project workspace in intellij.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.