Reputation: 1469
I am using IDEA to build a big maven project which contains a lot of submodules. And i could not find a similar feature which provided in eclipse. This feature has block me for years which avoid me to switch to IDEA.
In eclipse, there has a feature named "Enable Workspace Resolution". With this feature, all projects in eclipse workspace will be auto resolved by other project in same workspace (Eclipse will auto update build classpath, and replace dependencies jar path to other project's output folder like target/classes
). Then the dependencies will always point to the latest compiled class file, even you can update the class file in runtime (when debug, it will effect immediately if u did not update method signature but just method content).
For example, for a maven project like:
Project
|- module1
|- module2
|- pom.xml
module1 depends on module2, In eclipse, module1 will not find module2.jar from maven repo but directly from module2/target/classes(compile output folder). But IDEA will always try to find module2.jar from maven repo.
Any ideas?
Upvotes: 2
Views: 864
Reputation: 16401
In a multi-module Maven project IDE will resolve dependency to a module sources, rather than to a local maven jar library, if maven coordinates (groupId
, artifactId
, versionId
) are the same.
Also for the 'SNAPSHOT' version, dependency of the 'LATEST' version will be resolved.
For versions without 'SNAPSHOT' dependencies with versions declared as 'LATEST' and 'RELEASE' will be resolved.
Of course these modules should be present in current IDE project and added as a Maven modules.
Upvotes: 0
Reputation: 649
At our project we use multiple maven modules with dependencies to other our modules and I don't have any problems with IDEA similar to the ones you've described.
In my opinion there are 2 important moments to consider:
Always import module to IDEA as maven module. In other words click File
-> New
-> Module from Existing Sources...
-> select pom.xml
of your module. Otherwise IDEA will not download changed dependencies when pom.xml
has changed.
Use DEVELOPMENT-SNAPSHOT
(or exactly the same) version of your dependencies which are present at workspace. If you specify some other released version then (IDEA via) maven will download it from maven repo.
Upvotes: 1