You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Torben Knerr (JIRA)" <ji...@codehaus.org> on 2013/10/28 16:28:52 UTC

[jira] (MNG-3890) Transitive dependencies override explicitly set scope.

    [ https://jira.codehaus.org/browse/MNG-3890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=334782#comment-334782 ] 

Torben Knerr commented on MNG-3890:
-----------------------------------

Same problem here. Want to set {{javax.validation:validation-api}} to {{provided}} but it still ends up being packaged in the .war file, because it turns out to be a transitive dependency of {{gwt-user}} as well.

Workaround: set it to {{provided}} scope AND {{excludes}} it from the other artifact:
{code}
        <dependency>
	    <groupId>com.google.gwt</groupId>
	    <artifactId>gwt-user</artifactId>
	    <version>${gwtVersion}</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.validation</groupId>
                    <artifactId>validation-api</artifactId>
                </exclusion>
            </exclusions>
	</dependency>
...
	<dependency>
		<groupId>javax.validation</groupId>
		<artifactId>validation-api</artifactId>
		<scope>provided</scope>
	</dependency>
...
{code}
                
> Transitive dependencies override explicitly set scope.
> ------------------------------------------------------
>
>                 Key: MNG-3890
>                 URL: https://jira.codehaus.org/browse/MNG-3890
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Dependencies
>    Affects Versions: 2.0.9, 2.1.0-M1, 3.0-alpha-1
>            Reporter: Stephan Kleine
>            Priority: Critical
>             Fix For: 3.x / Backlog
>
>         Attachments: MMG-3890-core-it-suite.patch, testcase.tar.bz2
>
>
> Transitive dependencies override explicitly set scope.
> E.g. a project A depends on "Hibernate" with default scope and a project B depends on project A as well as on "Hibernate" for which it sets the scope explicitly to "provided". Further an EAR project C depends on project B (see the attached testcase).
> Now I would expect that C does not contain any jars for Hibernate and its dependencies since B explicitly set the scope to "provided". Sadly this is not the case and C contains all hibernate jars. The only way around this I have found is setting the scope to "provided" for Hibernate in A as well - which is just a crude hack that produces other issues.
> IMHO this is a bug because Maven should respect the overridden dependency scope since the current way forces me to set the scope to provided in A which is just wrong.
> Please try to get this fixed for 2.10 or 2.1 since it's a real pita atm.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira