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

Alex Clarke commented on MWAR-260:
----------------------------------

Hi Joerg,

Indeed it appears that you have a slightly different model in mind.  You are 
correct in that a war-overlay type is not directly deployable.  It can only be 
used when applied as an overlay to a war project.  The generation actually 
creates a jar as the primary artifact (made available on the classpath) and a 
zip file containing all web content (obviously excluding web-inf/classes as 
these are in the jar).

For us overlays are about being able to create logical modules to help break up 
large applications, although we only ever deploy as a whole.  It seems your 
model is more about creating smaller war files that can be developed and tested 
in isolation before being merged into one large deployable.  I can see that 
there is definitely a case for both scenarios.

Just to clarify my understanding of your scenario, suppose we flesh out the 
details of A,B,C :

{code}
A (war)
 +- /src/main/java/Class1.java
 +- /src/main/webapp/page1
 +- /src/main/webapp/page2
 +- /src/main/webapp/page3
 
B (war)  [depends on A, exclude /page1]
 +- /src/main/java/Class2.java
 +- /src/main/webapp/page3
 +- /src/main/webapp/page4

C (war) [depends on B]
+- /src/main/java/Class3.java
 +- /page5
{code}

You would expect the following:
{code}
a.jar  (contains Class1.class) 
a-webapp.war (contains page1,page2,page3 and a.jar (in WEB-INF/lib))
b.jar (contains Class2.class)
b-webapp.war (contains page2.page3(from b), page4, a.jar, b.jar)
c.jar (contains Class3.class)
c-webapp.war (contains page2.page3(from b), page4, page5, a.jar, b.jar, c.jar)
{code}

I have tried to create a sample project (attached) to replicate this.  It 
almost works except I cannot seem to stop artifacts from A appearing in C.

Our scenario is slightly different in that we do not have the same resource in 
more than one place:
{code}
A (war-overlay)
 +- /src/main/java/Class1.java
 +- /src/main/webapp/page1
 +- /src/main/webapp/page2
 
B (war-overlay)  [depends on A]
 +- /src/main/java/Class2.java
 +- /src/main/webapp/page3
 +- /src/main/webapp/page4

C (war) [depends on B]
 +- /src/main/java/Class3.java
 +- /page5
{code}

Creates:
{code}
a.waroverlay  (jar contains Class1.class) 
a -webcontent.waroverlay (contains page1,page2 (has no WEB-INF/lib))
b.waroverlay (contains Class2.class)
b-webcontent.waroverlay (contains page3, page4 (has no WEB-INF/lib))
c.war:
  /page1
  /page2  
  /page3
  /page4
  /page5
  /WEB-INF/classes/Class1.class
  /WEB-INF/classes/Class2.class
  /WEB-INF/classes/Class3.class
  /WEB-INF/lib/ <any dependencies> 
{code}

I hope that that helps to clarify the differences between the two approaches 
and hopefully makes the patch a more attractive proposition.  BTW are you a 
committer for maven-war-plugin?


> Patch to provide new war-overlay type
> -------------------------------------
>
>                 Key: MWAR-260
>                 URL: https://jira.codehaus.org/browse/MWAR-260
>             Project: Maven 2.x WAR Plugin
>          Issue Type: Improvement
>          Components: overlay
>    Affects Versions: 2.1.1
>            Reporter: Alex Clarke
>
> There are a number of bugs raised around support for WAR overlays:
> MWAR-73 - war overlay mechanism does not work for classes
> MWAR-253 - Inherit dependencies from a WAR type dependency when it is 
> overlayed.
> MWAR-194 - Warn when inconsistent jar versions are detected during overlay
> MWAR-220 - dependencyManagement && overlay + transitive dependency = multiple 
> versions of same dependency in WEB-INF/lib
> MWAR-33 - jars with differents versions can be in WEB-INF/lib with war as 
> dependencies
> Most of these relate to the fact that overlays are not treated as normal 
> maven dependencies.
> The code in https://github.com/SciSysUK/maven-plugins/tree/waroverlay 
> introduces a new packaging type of "war-overlay", that works in the following 
> way:
>     - The primary artifact is a jar containing the classes from the overlay
>     - Another artifact is attached containing the web content
>     - A dependency on a war-overlay will automatically pull both artifacts 
> into the packaged war
> To use the new type all you need to do is declare 
> <extensions>true</extensions> on the maven-war-plugin. There is an 
> integration test example here: 
> https://github.com/SciSysUK/maven-plugins/tree/waroverlay/maven-war-plugin/src/it/war-overlay.
>  
> If someone could review the code I could create a patch and update the site 
> documentation.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to