[ http://jira.codehaus.org/browse/MWAR-73?page=comments#action_73640 ] 
            
mark struberg commented on MWAR-73:
-----------------------------------

Hi Carlos!

The problem is, that the classes of the war, on which the actual war depends 
on, are not available at compiletime for the actual war.
For example: The class Test2 is in war2 and depends on war1 which has the Test1 
class + class Test2 extends Test1
So even if i switch the archiveClasses feature on, the compiler may not see the 
dependant classes at compile time.

What i have done so far to resolve this issue (i would rather consider it a 
bug) is to introduce a new WarClasspathMojo which temporary explodes any 
dependant war and adds a resourcePath to the 
target/$explodedWarPath/WEB-INF/classes directory. Since the maven-war-plugin 
is only active if the actual artifact is a war, this has imho no negative 
effects on building e.g. an EAR where this is not intended.

The new WarClasspathMojo is to be activated in the phase generate-resources.

> war overlay mechanism does not work for classes
> -----------------------------------------------
>
>                 Key: MWAR-73
>                 URL: http://jira.codehaus.org/browse/MWAR-73
>             Project: Maven 2.x War Plugin
>          Issue Type: Improvement
>    Affects Versions: 2.0, 2.1, 2.0.1, 2.0.2
>         Environment: all OS, all JDK, currently using jdk1.4.2_10 and 
> jdk1.5.0_06 under linux fedora core 5/x86_64 and sunOS5.10/Sparc64
>            Reporter: mark struberg
>         Attachments: maven-war-plugin-patch.tar.gz
>
>
> PROBLEM DESCRIPTION:
> When building a WAR (e.g. war2.war) which depends on another WAR (e.g. 
> war1.war), the web-resources from the dependant war are beeing used as base 
> for overlaying. 
> This mechanism doesn't currently work for the classes within the dependant 
> war, altough it is specified by the plugin documentation 
> See the SampleActionDependency.class in 
> http://maven.apache.org/plugins/maven-war-plugin/examples/war-overlay.html 
> APPLIED PATCH:
> I have written two simple war examples war1 and war2 and extended the 
> maven-war-plugin by an own WarClasspathMojo which is bound to the phase 
> generate-resources to fix this issue.
> Since i found no way to add non-artifact parts to the classpath, i simply 
> unpack all dependant war files (reusing the functions already there in 
> AbstractWarMojo) and add a resource-path to the 
> $explodedWarDir/WEB-INF/classes for each of them. The 
> The implementation fits all my needs, but if you provide me with a hint how 
> it may be improved, then let me know.
> KNOWN ISSUES:
> This mechanism currently doesn't work if you have specified to generate an 
> archive for the dependant war's classes.

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