You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Shute, James" <ja...@lehman.com> on 2007/04/17 16:11:55 UTC

M2 : Controlling WEB-INF/lib contents in war

I'm having a go at migrating my app to M2 and have hit a bit of a
roadblock.  For my war module I don't want the dependencies to go into
WEB-INF/lib, with the exception of 2 of them, which do have to live in
there (for reasons to do with Weblogic's class-loading)

Now under M1 this was easy - just set the war.bundle property
appropriately when defining the dependencies.

I've read this article:
http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.ht
ml

That lets me stop all jars going into that dir, but I can't find any way
to specify things so those 2 special cases do get included.

An alternative approach I've tried is in the pom for the war to specify
the dependencies again, but with a scope of provided, which does stop
them being bundled in.  However this is a bit of a hack as if I change
the versions / add dependencies in future I've got to remember to change
them there too, which isn't great.  If there was some way to specify the
overriding dependency so it picked up the version already defined that
would be an improvement - is that possible?

Any suggestions / advice very much appreciated

thanks

James


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: M2 : Controlling WEB-INF/lib contents in war

Posted by "Shute, James" <ja...@lehman.com>.
I had already seen about scopes and my original mail did note that
setting the scope to provided for a.jar and b.jar did give me the layout
I wanted, but meant I had to duplicate all the <dependency><version>
details which I wasn't keen on.

I have now found the <dependencyManagement> section I can declare in the
parent POM which means I can declare the version in that, and then the
scope override in my webapp module pom.  This seems to give me what I
need for my command line build which is a good start.  Unfortunately the
corresponding IDEA module generated suffers from the bug MIDEA-62, but
that'll get fixed when the 2.1 version of that plugin is released.

thanks

-----Original Message-----
From: Jerome Lacoste [mailto:jerome.lacoste@gmail.com] 
Sent: Tuesday, April 17, 2007 5:04 PM
To: Maven Users List
Subject: Re: M2 : Controlling WEB-INF/lib contents in war

On 4/17/07, Shute, James <ja...@lehman.com> wrote:
>
> The target layout I'm after is:
>
> ear
> |
> |-lib
> |  |-a.jar
> |  |-b.jar
> |
> |-webapp
>    |
>    |-WEB-INF
>        |-web.xml
>        |-lib
>            |-c.jar
>
> I can't use warSourceExcludes as AFAIK excludes take precedence over

james,

I think you need to look at the bottom of
http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-g
uide.html

in particular:

 <dependencies>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar1</artifactId>
      <version>${pom.version}</version>
      <optional>true</optional>
      <!-- goes in manifest classpath, but not included in WEB-INF/lib
-->
    </dependency>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar2</artifactId>
      <version>${pom.version}</version>
      <!-- goes in manifest classpath, AND included in WEB-INF/lib -->
    </dependency>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar1</artifactId>
      <version>${pom.version}</version>
      <scope>provided</scope>
      <!-- excluded from manifest classpath, and excluded from
WEB-INF/lib -->
    </dependency>

Jerome

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2 : Controlling WEB-INF/lib contents in war

Posted by Jerome Lacoste <je...@gmail.com>.
On 4/17/07, Shute, James <ja...@lehman.com> wrote:
>
> The target layout I'm after is:
>
> ear
> |
> |-lib
> |  |-a.jar
> |  |-b.jar
> |
> |-webapp
>    |
>    |-WEB-INF
>        |-web.xml
>        |-lib
>            |-c.jar
>
> I can't use warSourceExcludes as AFAIK excludes take precedence over

james,

I think you need to look at the bottom of
http://maven.apache.org/plugins/maven-war-plugin/examples/war-manifest-guide.html

in particular:

 <dependencies>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar1</artifactId>
      <version>${pom.version}</version>
      <optional>true</optional>
      <!-- goes in manifest classpath, but not included in WEB-INF/lib -->
    </dependency>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar2</artifactId>
      <version>${pom.version}</version>
      <!-- goes in manifest classpath, AND included in WEB-INF/lib -->
    </dependency>
    <dependency>
      <groupId>org.foo</groupId>
      <artifactId>bar-jar1</artifactId>
      <version>${pom.version}</version>
      <scope>provided</scope>
      <!-- excluded from manifest classpath, and excluded from WEB-INF/lib -->
    </dependency>

Jerome

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: M2 : Controlling WEB-INF/lib contents in war

Posted by "Shute, James" <ja...@lehman.com>.
The target layout I'm after is:

ear
|
|-lib
|  |-a.jar
|  |-b.jar
|
|-webapp
   |
   |-WEB-INF
       |-web.xml
       |-lib
           |-c.jar       

I can't use warSourceExcludes as AFAIK excludes take precedence over
includes, so I can't exclude *.jar but then include c.jar

For it to work using warSourceIncludes I'd need to be able to specify:
- **/*.xml
- **/*.css
- **/*.jpg (etc)
- **/c.jar

but warSourceIncludes only lets you specify a single value as sadly it
doesn't take a list of <include>s.  I have tried a comma separated list
but that doesn't work either.  Even if it did the include list is pretty
ugly and error prone.

thanks 

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Tuesday, April 17, 2007 3:55 PM
To: Maven Users List
Subject: Re: M2 : Controlling WEB-INF/lib contents in war

2007/4/17, Kathryn Huxtable <kh...@ku.edu>:
> He meant "scope". -K

No, no! I meant profile, but I misunderstood his needs.
James, why using "warSourceIncludes" for your 2 special cases is not
feasible?
Do you mean that in the EAR there could be a previous version of a JAR
than that in the WAR?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2 : Controlling WEB-INF/lib contents in war

Posted by Antonio Petrelli <an...@gmail.com>.
2007/4/17, Kathryn Huxtable <kh...@ku.edu>:
> He meant "scope". -K

No, no! I meant profile, but I misunderstood his needs.
James, why using "warSourceIncludes" for your 2 special cases is not feasible?
Do you mean that in the EAR there could be a previous version of a JAR
than that in the WAR?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2 : Controlling WEB-INF/lib contents in war

Posted by Kathryn Huxtable <kh...@ku.edu>.
He meant "scope". -K


On 4/17/07 9:35 AM, "Shute, James" <ja...@lehman.com> wrote:

> 
> Not sure I follow how profiles help here?  My understanding was that
> they let you control different versions of the build, e.g. to target
> different runtimes / containers etc.  I don't have any such requirement
> - I just want to build my ear file one way all the time.
> 
> NB: "Provided" works for me here as the jars will be in the main ear
> file, so will be available to the war file
> 
> thanks
> 
> -----Original Message-----
> From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com]
> Sent: Tuesday, April 17, 2007 3:24 PM
> To: Maven Users List
> Subject: Re: M2 : Controlling WEB-INF/lib contents in war
> 
> 2007/4/17, Shute, James <ja...@lehman.com>:
>> An alternative approach I've tried is in the pom for the war to
>> specify the dependencies again, but with a scope of provided, which
>> does stop them being bundled in.  However this is a bit of a hack as
>> if I change the versions / add dependencies in future I've got to
>> remember to change them there too, which isn't great.
> 
> Use different profiles. The "provided" scope means exactly that the
> "container will provide it". If it is in a directory of your Weblogic
> instance, well, I think it's provided :-)
> 
> Antonio
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - -
> 
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above.  If you are not the intended recipient of
> this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited.  This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
> secure or error-free.  Therefore, we do not represent that this information is
> complete or accurate and it should not be relied upon as such.  All
> information is subject to change without notice.
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: M2 : Controlling WEB-INF/lib contents in war

Posted by "Shute, James" <ja...@lehman.com>.
Not sure I follow how profiles help here?  My understanding was that
they let you control different versions of the build, e.g. to target
different runtimes / containers etc.  I don't have any such requirement
- I just want to build my ear file one way all the time.

NB: "Provided" works for me here as the jars will be in the main ear
file, so will be available to the war file

thanks

-----Original Message-----
From: Antonio Petrelli [mailto:antonio.petrelli@gmail.com] 
Sent: Tuesday, April 17, 2007 3:24 PM
To: Maven Users List
Subject: Re: M2 : Controlling WEB-INF/lib contents in war

2007/4/17, Shute, James <ja...@lehman.com>:
> An alternative approach I've tried is in the pom for the war to 
> specify the dependencies again, but with a scope of provided, which 
> does stop them being bundled in.  However this is a bit of a hack as 
> if I change the versions / add dependencies in future I've got to 
> remember to change them there too, which isn't great.

Use different profiles. The "provided" scope means exactly that the
"container will provide it". If it is in a directory of your Weblogic
instance, well, I think it's provided :-)

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: M2 : Controlling WEB-INF/lib contents in war

Posted by Antonio Petrelli <an...@gmail.com>.
2007/4/17, Shute, James <ja...@lehman.com>:
> An alternative approach I've tried is in the pom for the war to specify
> the dependencies again, but with a scope of provided, which does stop
> them being bundled in.  However this is a bit of a hack as if I change
> the versions / add dependencies in future I've got to remember to change
> them there too, which isn't great.

Use different profiles. The "provided" scope means exactly that the
"container will provide it". If it is in a directory of your Weblogic
instance, well, I think it's provided :-)

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org