[ 
https://issues.apache.org/jira/browse/MNG-5978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15147312#comment-15147312
 ] 

Nadav Wexler commented on MNG-5978:
-----------------------------------

sorry for the unclearness, I'll try to give an example:

let's have a test library:
<project ...>
    <groupId>com.example</groupId>
    <artifactId>test-library</artifactId>
    <expectedScope>test</expectedScope> <!-- or any other agreed tag name -->
</project>

now we have some other project that needs the test library in test scope
<project>
    <groupId>com.example</groupId>
    <artifactId>production-project</artifactId>

    <dependencies>
        <dependency>
                <groupId>com.example</groupId>
               <artifactId>test-library</artifactId>
                <scope>test</scope> 
        <dependency>
    </dependencies>
</project>

we have another test project, that does not declare the scope correctly:
<project>
    <groupId>com.example</groupId>
    <artifactId>production-project-warning</artifactId>

    <dependencies>
        <dependency>
                <groupId>com.example</groupId>
               <artifactId>test-library</artifactId>
        <dependency>
    </dependencies>
</project>

this should be warning as the test library will be included in production code.

on the other hand, if we have another test library, it will not complain:
<project>
    <groupId>com.example</groupId>
    <artifactId>another-test-library</artifactId>
    <expectedScope>test</expectedScope>

    <dependencies>
        <dependency>
                <groupId>com.example</groupId>
               <artifactId>test-library</artifactId>
        <dependency>
    </dependencies>
</project>

now, I'm not sure this is a core maven wish.. if it is not, I'd love to hear 
your ideas on where it should be.
at least for me this is a very real issue because it happened several times 
that developers missed the scope and got huge deployable.

Thanks!



> test libraries should declare expected scope in their pom
> ---------------------------------------------------------
>
>                 Key: MNG-5978
>                 URL: https://issues.apache.org/jira/browse/MNG-5978
>             Project: Maven
>          Issue Type: Wish
>          Components: Dependencies
>            Reporter: Nadav Wexler
>
> when using test libraries and forgetting to include the expected 
> <scope>test</scope> this could have your jars and wars inflated and could 
> also create some problems in your environment.
> I suggest to include the expected scope in your pom, and then when depending 
> on that library, checking against the actual pom.
> if those do not match then a warning should be triggered.
> also this should be recursive - the check should not emit a warning if the 
> using library is also a test library.
> I'd love to hear your comments on this Wish!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to