Quantcast
Channel: JetBrains Developer Community : All Content - IntelliJ IDEA Users
Viewing all articles
Browse latest Browse all 5481

Classpath in run configurations - source root vs. test source root

$
0
0

Hello,

 

In a Maven 3 project, some dependencies can be in a "provided" scope[1].

 

Based on the linked document, these dependencies are supposed to be present at compile time, and test time.

 

If I have a project with a JUnit test class in src/test/java, then the provided dependencies are correctly added to the run configuration's classpath. However, if the JUnit test class is in src/main/java, then IDEA offers to launch the JUnit test in a new run configuration but does not add the provided dependencies to the classpath.

 

Having a JUnit test in src/main/java sure is unusual, but we have a use case where multi-module projects include a separate module that contains all the system tests in src/main/java. Those are not run at build time but only from the IDE when targetting the deployed application.

 

Since IDEA 13 actually sees that these classes are JUnit test classes and offers to run them as such, I would expect the IDE to include the dependencies in the "provided" scope. The classpath of the JUnit test is incorrectly built in this case.

 

Any thoughts on this?

 

Best regards,

 

Sébastien

 

[1] http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope


Viewing all articles
Browse latest Browse all 5481