Runtime dependencies included on classpath during compiler:testCompile
----------------------------------------------------------------------

                 Key: MCOMPILER-69
                 URL: http://jira.codehaus.org/browse/MCOMPILER-69
             Project: Maven 2.x Compiler Plugin
          Issue Type: Bug
    Affects Versions: 2.0.2
            Reporter: marekk


When executing compiler:testCompile, all runtime dependencies are added to the 
classpath to compile the test source code.  This is contrary to the purpose of 
the runtime scope, which is simply to include the dependency when running the 
code, not compiling.

Here is what Maven's website[1] says about the runtime scope:
"this scope indicates that the dependency is not required for compilation, but 
is for execution. It is in the runtime and test classpaths, but not the compile 
classpath."

...And here is what Better Builds with Maven says about the runtime scope:
"This is because, in this situation, the (runtime) dependency is used only for 
packaging, not for compilation. In fact, if the dependency were required for 
compilation, for stability it would always be declared in the current POM as a 
dependency - regardless of whether another dependency introduces it." - page 65

"Check that the scope of your dependencies are set correctly (to test if only 
used for unit tests, or runtime if it is needed to bundle with or run the 
application but not for compiling your source code)." - page 204

[1] 
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
[2] http://www.devzuz.com/web/guest/products/resources#BBWM

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to