I would create a separate module that builds the test overlay war file and
leave the production artifact unmolested always

On Friday, 14 December 2012, Winsor, Daniel wrote:

> Hi,
>
> It appears we are using 2.0 of maven-war-plugin due to some incorrect
> dependency graphs - at least that's what the comment says.
> I'm testing maven-war-plugin with 2.3 right now, and I can confirm that
> the optional dependency is overlaid.
>
> However, it brings up a new problem.  In my first email I mentioned that I
> am overlaying with a skip parameter, as in:
> //parent-of-everything/pom.xml
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-war-plugin</artifactId>
>   <configuration>
>     <overlays>
>       <overlay>
>         <artifactId>to-be-overlaid</artifactId>
>         <skip>${exclude.optional.overlay}</skip>
>         <includes>
>           <include>**</include>
>         </includes>
>       </overlay>
>       <overlay>
>         <!-- default self overlay -->
>       </overlay>
>     </overlays>
>   </configuration>
> </plugin>
>
> So if the overlay is skipped, I don't want my files to show up, period.
> The new problem is that the to-be-overlaid dependency, whether optional or
> not, is included in my jetty webapp context, since it is a war dependency.
>  Since to-be-overlaid is in the context, the files are present at runtime.
>  The jetty-maven-plugin is part of the same profile in the
> parent-of-everything/pom.xml
> JettyWebAppContext@772eab80
> @772eab80/,[file:/Users/dwinsor/project/target/t
> mp/webinf/, [file:/Users/dwinsor/project/src/main/webapp/,
> jar:file:/Users/dwinsor/.m2/repository/to-be-overlaid-SNAPSHOT.war!/,
> jar:file:/Users/dwinsor/project/target/some-webapp-war.war!/]],[file:/Users
> /dwinsor/project/src/main/webapp/] started
>
> So maybe I'm going about this the wrong way.  What I want is to have test
> files applied to a war in a development environment and totally absent
> from a production environment.  Am I on the right track and somehow
> messing up, or am I on the wrong track and there's a better or easier way?
>
>
> Thank you,
> Daniel Winsor
> Associate, IT Architecture
>
>
>
>
> On 12/8/12 12:35 PM, "Dennis Lundberg" <[email protected]> wrote:
>
> >Hi Daniel,
> >
> >The 2.0 version of Maven WAR Plugin is over 6 years old. The first thing
> >I'd do is try a later version to see if it solves your problem. The
> >latest version is 2.3.
> >
> >On 2012-12-08 02:32, Winsor, Daniel wrote:
> >> Hi,
> >>
> >> I have declared an optional dependency, but it is not being overlaid
> >>with maven-war-plugin v 2.0
> >>
> >> //parent-of-everything/pom.xml
> >>
> >> <plugin>
> >>
> >>     <groupId>org.apache.maven.plugins</groupId>
> >>
> >>     <artifactId>maven-war-plugin</artifactId>
> >>
> >>     <configuration>
> >>
> >>         <overlays>
> >>
> >>             <overlay>
> >>
> >>                 <artifactId>to-be-overlaid</artifactId>
> >>
> >>                 <includes>
> >>
> >>                     <include>**</include>
> >>
> >>                 </includes>
> >>
> >>             </overlay>
> >>
> >>             <overlay>
> >>
> >>                 <!-- default self overlay -->
> >>
> >>             </overlay>
> >>
> >>         </overlays>
> >>
> >>     </configuration>
> >>
> >> </plugin>
> >>
> >>
> >>
> >> //some-webapp-war/pom.xml
> >>
> >>     <dependencies>
> >>
> >>         <dependency>
> >>
> >>             <artifactId>to-be-overlaid</artifactId>
> >>
> >>             <optional>true</optional>
> >>
> >>             <type>war</type>
> >>
> >>         </dependency>
> >>
> >>     </dependencies>
> >>
> >>
> >> When optional is set to false, then
> >>
> >> [INFO] Assembling webapp some-webapp-war in /target/some-webapp-war
> >>
> >> [INFO] Expanding: /.m2/repository/to-be-overlaid.war into
> >>/target/to-be-overlaid
> >>
> >> [INFO] Overlaying 1 war(s).
> >>
> >>
> >> When optional is set to true, then no such overlaying happens.
> >>
> >> However, according to optional dependencies, if some-webapp-war
> >>optionally depends on to-be-overlaid, well it should show up in this
> >>first level dependency, just like normal.  What is going on here?  And
> >>how can I best overlay a war to certain other wars while leaving them
> >>out of most wars using parent-of-everything (I am currently using a
> >>property in the skip parameter in maven-war-plugin)?
> >>
> >> Thank you,
> >> Daniel Winsor
> >> Associate, IT Architecture
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >>
> >
> >
> >--
> >Dennis Lundberg
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [email protected]
> >For additional commands, e-mail: [email protected]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mai

Reply via email to