Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.6
-
Fix Version/s: None
-
Labels:None
-
Environment:maven 2.0.9
Java 6
Eclipse 3.4.2
WinXP
-
Number of attachments :
Description
"runtime" scope dependencies are today included by "mvn eclipse:eclipse" into the .classpath as the other compile dependencies. It should not since it make possible to use these runtime dependencies by mistake into Eclipse and then write code which is broken the "mvn compile" goal.
Ideally the "runtime" dependencies should not be included into the .classpath, but add only as "User entries" into the "Run configuration -> Classpath" of Eclipse
This doesn't just affect the runtime scope, though: test scope dependencies are usable anywhere in the resulting Eclipse project, even though using them in the wrong part of the project prevents mvn compile from building your project. I don't think there's a good way around this in the general case: Eclipse, ultimately, only has one classpath scope, which is tied to the whole project.
Get in the habit of checking your commits by doing a clean build in maven before committing, and set up CI (hudson, bamboo, cruisecontrol, whatever) to catch the ones you and your team miss. It's not optimal, but without more support for dependency scoping in eclipse, it's probably as good as it gets.
Before someone suggests it, no, dependency filtering (through Eclipse's include/exclude feature) isn't good enough - it goes the wrong direction, so you can't say that src/main/java excludes org.junit and unit.