[ 
http://jira.codehaus.org/browse/MWAR-33?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=163848#action_163848
 ] 

Alex Rau commented on MWAR-33:
------------------------------

Good news.

I looks to me as I was able to work around the issue. After a long-day debug 
session in maven I figured out how to enable the inclusion of transitive 
dependencies on WAR dependencies.

I changed 
apache-maven-2.0.9/lib/maven-2.0.9-uber.jar/META-INF/plexus/components.xml 
which obviously configures the plexus container and its components. 

    <component>
      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
      <role-hint>war</role-hint>
      
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
      <configuration>
        <type>war</type>
        <includesDependencies>false</includesDependencies>
        <language>java</language>
        <addedToClasspath>false</addedToClasspath>
      </configuration>
    </component>

Changing <includeDependendies/> from true to false for WAR artifacts causes 
Maven to not consider dependencies from WAR artifacts to be already included in 
the WAR artifact itself. Instead they are *properly* resolved including a 
proper dependency resolution. I'll attach an sample overlay project so that 
this is reproducible for others.

Using the following section in the overlay build itself leads to an empty 
WEB-INF/lib for the overlay. 

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <dependentWarExcludes>
          WEB-INF/lib/*.jar</dependentWarExcludes>
        </configuration>
      </plugin>
    </plugins>
  </build>

This in combination with the above <includesDependencies/> change means: an 
overlay's WEB-INF/lib is populated with *all* transitive dependencies from 
scratch. Be aware that I only exclude JAR dependencies here for now.

Does that make sense ? Feedback appreciated. Personally I would consider this 
to be the expected default behaviour (compatibility-issues aside) and would 
love to see that behaviour in a newer release (either default behaviour or a 
configuration option somewhere). Right now everyone here has to apply these 
settings manually in their maven installation which is ok for now (but not in 
the long term).

Someone can give feedback on the consequences and side-effects of the above 
change ? Do we break something here in this respect in other places ?

Regards Alex

> jars with differents versions can be in WEB-INF/lib with war as dependencies
> ----------------------------------------------------------------------------
>
>                 Key: MWAR-33
>                 URL: http://jira.codehaus.org/browse/MWAR-33
>             Project: Maven 2.x War Plugin
>          Issue Type: Bug
>         Environment: all
>            Reporter: Olivier Lamy
>            Assignee: Stephane Nicoll
>             Fix For: 2.1
>
>   Original Estimate: 15 minutes
>          Time Spent: 30 minutes
>  Remaining Estimate: 0 minutes
>
> My pom has the following dependencies :
> - log4j:log4j:1.2.13
> - a war with log4j:log4j:1.2.11 included 
> Result the two jars are in WEB-INF/lib.

-- 
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