You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "marekk (JIRA)" <ji...@codehaus.org> on 2008/02/27 23:55:28 UTC

[jira] Created: (MCOMPILER-69) Runtime dependencies included on classpath during compiler:testCompile

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

        

[jira] Commented: (MCOMPILER-69) Runtime dependencies included on classpath during compiler:testCompile

Posted by "Robert Scholte (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MCOMPILER-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=277320#comment-277320 ] 

Robert Scholte commented on MCOMPILER-69:
-----------------------------------------

If you check http://maven.apache.org/developers/mojo-api-specification.html#The_Descriptor_and_Annotations and see the options for requiresDependencyResolution you'll see the problem: There's no _requiredClassPath_ value just for just test-compilation. The _test_-value is used for executing tests and for that reason all dependencies are selected.


> Runtime dependencies included on classpath during compiler:testCompile
> ----------------------------------------------------------------------
>
>                 Key: MCOMPILER-69
>                 URL: https://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.
For more information on JIRA, see: http://www.atlassian.com/software/jira