I'm using Intellij-IDEA 11. If there's a solution that works in 12, I'd be willing to upgrade for that.
I built a library that many projects depend on but the library changes often. This library is added to my project's pom.xml as a normal dependency:
<dependency>
<groupId>my.company</groupId>
<artifactId>MyLibrary</artifactId>
</dependency>
This is a typical series of steps I need to take when I add a feature to my project:
Outside of my IDE (which happens to be Intellij-IDEA), this is a straight forward process: I add step 2.5 which is to cd into the dependency's project folder and then mvn install
the library.
But I don't know a convenient way to do this in Intellij-IDEA. Ideally, I'd modify the source of the library inside Intellij, click the green play button and the IDE would figure out to use the modified sources of the library.
Right now, since the library is a dependency, it just uses what's already in my local repo. So modifying the source of the library doesn't have an affect until I manually mvn install
it.
Note: I've figured out a trick that seems to work. If I modify the project's parent pom to include the library as a maven module and then include the same library as an intellij module, it uses that source instead of the jar in my local repo. But I don't like this solution because I'd never want to commit that modified pom (because the module has to point to a file system path that only exists on my local file system).
I've found a bug in the Intellij-IDEA bug tracker that seems to relate to this: http://youtrack.jetbrains.com/issue/IDEA-25146
I found out a way to do this. First, you add the library's pom.xml in the Maven Projects tool window. Then you Edit your configurations so that they run the install goal of your library. And image of how to do this is provided below.
Click here for a full sized link
Open module setting (F4 on a module), go to Modules, select the dependencies tab in module that depepends on your library.
If the library is a module add a module dependency If the library isn't a module, I assume it gets built and put somewhere, add that directory to the module dependencies.
The higher up the list the higher its priority
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With