You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Enrique Gaona <eg...@us.ibm.com> on 2006/11/14 20:33:59 UTC

Maven dependency question


Hi folks,

We have a J2EE application project (ear) which contains one Web project
(war), one EJB project and one utilities java project.
The war and EJB jar projects depends from the same utilities project.
We included the WEB, EJB and utilities projects as dependencies into the
ear pom file, so all three output files are included into ear file.
EJB project works as expected it only adds Class-Path: entry into its
Manifest.MF class

The problem with the Web project, it adds the common utility jar file into
its WEB-INF/lib directory. We tried to change the dependency scope from
"compile" to "provided". In this case neither the jar was  added nor the
Class-Path: entry.

How can we specify dependency from the common utility jar file in the war's
pom file?

Any help is appreciated.  Thanks

Enrique

Re: Maven dependency question

Posted by Enrique Gaona <eg...@us.ibm.com>.
Thanks for the info, that helped a lot.

Enrique

leemeador76018@gmail.com wrote on 11/14/2006 03:17:07 PM:

> What I do is put the utility jar in my dependency for the war as compile.
> Then I put an exclude in the pom for the war that tells it to leave out
the
> jar and not put it into the war. The classloader for your application
server
> should cause the war to have access to the jar since it is in the ejb
jar's
> classpath. This has to do with the nesting of the classloaders. Some app
> servers let you change the way that works though.
>
> -- Lee
>
> On 11/14/06, Enrique Gaona <eg...@us.ibm.com> wrote:
> >
> >
> >
> > Hi folks,
> >
> > We have a J2EE application project (ear) which contains one Web project
> > (war), one EJB project and one utilities java project.
> > The war and EJB jar projects depends from the same utilities project.
> > We included the WEB, EJB and utilities projects as dependencies into
the
> > ear pom file, so all three output files are included into ear file.
> > EJB project works as expected it only adds Class-Path: entry into its
> > Manifest.MF class
> >
> > The problem with the Web project, it adds the common utility jar file
into
> > its WEB-INF/lib directory. We tried to change the dependency scope from
> > "compile" to "provided". In this case neither the jar was  added nor
the
> > Class-Path: entry.
> >
> > How can we specify dependency from the common utility jar file in the
> > war's
> > pom file?
> >
> > Any help is appreciated.  Thanks
> >
> > Enrique
> >
>
>
>
> --
> -- Lee Meador
> Sent from gmail. My real email address is lee AT leemeador.com

Re: Maven dependency question

Posted by Lee Meador <le...@leemeador.com>.
What I do is put the utility jar in my dependency for the war as compile.
Then I put an exclude in the pom for the war that tells it to leave out the
jar and not put it into the war. The classloader for your application server
should cause the war to have access to the jar since it is in the ejb jar's
classpath. This has to do with the nesting of the classloaders. Some app
servers let you change the way that works though.

-- Lee

On 11/14/06, Enrique Gaona <eg...@us.ibm.com> wrote:
>
>
>
> Hi folks,
>
> We have a J2EE application project (ear) which contains one Web project
> (war), one EJB project and one utilities java project.
> The war and EJB jar projects depends from the same utilities project.
> We included the WEB, EJB and utilities projects as dependencies into the
> ear pom file, so all three output files are included into ear file.
> EJB project works as expected it only adds Class-Path: entry into its
> Manifest.MF class
>
> The problem with the Web project, it adds the common utility jar file into
> its WEB-INF/lib directory. We tried to change the dependency scope from
> "compile" to "provided". In this case neither the jar was  added nor the
> Class-Path: entry.
>
> How can we specify dependency from the common utility jar file in the
> war's
> pom file?
>
> Any help is appreciated.  Thanks
>
> Enrique
>



-- 
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

Re: Maven dependency question

Posted by Enrique Gaona <eg...@us.ibm.com>.
Thanks for the detailed example.

Enrique

"Eric Helfrich" <eh...@gmail.com> wrote on 11/15/2006 12:02:27 PM:

> I did it this way.  The classpath gets generated with the jars for the
war
> but no jar files get added to the lib directory
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-war-plugin</artifactId>
>                 <version>2.0.1</version>
>                 <configuration>
>                     <outputDirectory>
>                         ${basedir}/../target/${artifactId}
>                     </outputDirectory>
>                     <warSourceExcludes>
>                         WEB-INF/lib/*.jar
>                     </warSourceExcludes>
>                     <archive>
>                         <addMavenDescriptor>false</addMavenDescriptor>
>                         <manifest>
>                             <addClasspath>true</addClasspath>
>                         </manifest>
>                     </archive>
>                 </configuration>
>             </plugin>
>
> On 11/15/06, Wayne Fay <wa...@gmail.com> wrote:
> >
> > Incorrect, Lee M. responded to you earlier...
> >
> > ---------- Forwarded message ----------
> > From: Lee Meador <le...@leemeador.com>
> > Date: Nov 14, 2006 3:17 PM
> > Subject: Re: Maven dependency question
> > To: Maven Users List <us...@maven.apache.org>
> >
> >
> > What I do is put the utility jar in my dependency for the war as
compile.
> > Then I put an exclude in the pom for the war that tells it to leave out
> > the
> > jar and not put it into the war. The classloader for your application
> > server
> > should cause the war to have access to the jar since it is in the ejb
> > jar's
> > classpath. This has to do with the nesting of the classloaders. Some
app
> > servers let you change the way that works though.
> >
> > -- Lee
> >
> >
> > On 11/14/06, Enrique Gaona <eg...@us.ibm.com> wrote:
> > >
> > >
> > >
> > > I posted this message earlier and didnt get any replies. Anyone know
the
> > answer:) Thanks.
> > >
> > > Enrique
> > >
> > > Enrique Gaona/Austin/IBM@IBMUS
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Enrique Gaona/Austin/IBM@IBMUS
> > >
> > > 11/14/2006 01:33 PM
> > >
> > > Please respond to
> > > "Maven Users List" <us...@maven.apache.org>
> > >
> > >
> > > To
> > > users@maven.apache.org
> > >
> > >
> > > cc
> > >
> > >
> > >
> > > Subject
> > > Maven dependency question
> > >
> > >
> > >
> > >
> > > Hi folks,
> > >
> > > We have a J2EE application project (ear) which contains one Web
project
> > > (war), one EJB project and one utilities java project.
> > > The war and EJB jar projects depends from the same utilities project.
> > > We included the WEB, EJB and utilities projects as dependencies into
the
> > > ear pom file, so all three output files are included into ear file.
> > > EJB project works as expected it only adds Class-Path: entry into its
> > > Manifest.MF class
> > >
> > > The problem with the Web project, it adds the common utility jar file
> > into
> > > its WEB-INF/lib directory. We tried to change the dependency scope
from
> > > "compile" to "provided". In this case neither the jar was  added nor
the
> > > Class-Path: entry.
> > >
> > > How can we specify dependency from the common utility jar file in the
> > war's
> > > pom file?
> > >
> > > Any help is appreciated.  Thanks
> > >
> > > Enrique
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >

Re: Maven dependency question

Posted by Eric Helfrich <eh...@gmail.com>.
I did it this way.  The classpath gets generated with the jars for the war
but no jar files get added to the lib directory
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.0.1</version>
                <configuration>
                    <outputDirectory>
                        ${basedir}/../target/${artifactId}
                    </outputDirectory>
                    <warSourceExcludes>
                        WEB-INF/lib/*.jar
                    </warSourceExcludes>
                    <archive>
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

On 11/15/06, Wayne Fay <wa...@gmail.com> wrote:
>
> Incorrect, Lee M. responded to you earlier...
>
> ---------- Forwarded message ----------
> From: Lee Meador <le...@leemeador.com>
> Date: Nov 14, 2006 3:17 PM
> Subject: Re: Maven dependency question
> To: Maven Users List <us...@maven.apache.org>
>
>
> What I do is put the utility jar in my dependency for the war as compile.
> Then I put an exclude in the pom for the war that tells it to leave out
> the
> jar and not put it into the war. The classloader for your application
> server
> should cause the war to have access to the jar since it is in the ejb
> jar's
> classpath. This has to do with the nesting of the classloaders. Some app
> servers let you change the way that works though.
>
> -- Lee
>
>
> On 11/14/06, Enrique Gaona <eg...@us.ibm.com> wrote:
> >
> >
> >
> > I posted this message earlier and didnt get any replies. Anyone know the
> answer:) Thanks.
> >
> > Enrique
> >
> > Enrique Gaona/Austin/IBM@IBMUS
> >
> >
> >
> >
> >
> >
> >
> > Enrique Gaona/Austin/IBM@IBMUS
> >
> > 11/14/2006 01:33 PM
> >
> > Please respond to
> > "Maven Users List" <us...@maven.apache.org>
> >
> >
> > To
> > users@maven.apache.org
> >
> >
> > cc
> >
> >
> >
> > Subject
> > Maven dependency question
> >
> >
> >
> >
> > Hi folks,
> >
> > We have a J2EE application project (ear) which contains one Web project
> > (war), one EJB project and one utilities java project.
> > The war and EJB jar projects depends from the same utilities project.
> > We included the WEB, EJB and utilities projects as dependencies into the
> > ear pom file, so all three output files are included into ear file.
> > EJB project works as expected it only adds Class-Path: entry into its
> > Manifest.MF class
> >
> > The problem with the Web project, it adds the common utility jar file
> into
> > its WEB-INF/lib directory. We tried to change the dependency scope from
> > "compile" to "provided". In this case neither the jar was  added nor the
> > Class-Path: entry.
> >
> > How can we specify dependency from the common utility jar file in the
> war's
> > pom file?
> >
> > Any help is appreciated.  Thanks
> >
> > Enrique
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven dependency question

Posted by Wayne Fay <wa...@gmail.com>.
Incorrect, Lee M. responded to you earlier...

---------- Forwarded message ----------
From: Lee Meador <le...@leemeador.com>
Date: Nov 14, 2006 3:17 PM
Subject: Re: Maven dependency question
To: Maven Users List <us...@maven.apache.org>


What I do is put the utility jar in my dependency for the war as compile.
Then I put an exclude in the pom for the war that tells it to leave out the
jar and not put it into the war. The classloader for your application server
should cause the war to have access to the jar since it is in the ejb jar's
classpath. This has to do with the nesting of the classloaders. Some app
servers let you change the way that works though.

-- Lee


On 11/14/06, Enrique Gaona <eg...@us.ibm.com> wrote:
>
>
>
> I posted this message earlier and didnt get any replies. Anyone know the answer:) Thanks.
>
> Enrique
>
> Enrique Gaona/Austin/IBM@IBMUS
>
>
>
>
>
>
>
> Enrique Gaona/Austin/IBM@IBMUS
>
> 11/14/2006 01:33 PM
>
> Please respond to
> "Maven Users List" <us...@maven.apache.org>
>
>
> To
> users@maven.apache.org
>
>
> cc
>
>
>
> Subject
> Maven dependency question
>
>
>
>
> Hi folks,
>
> We have a J2EE application project (ear) which contains one Web project
> (war), one EJB project and one utilities java project.
> The war and EJB jar projects depends from the same utilities project.
> We included the WEB, EJB and utilities projects as dependencies into the
> ear pom file, so all three output files are included into ear file.
> EJB project works as expected it only adds Class-Path: entry into its
> Manifest.MF class
>
> The problem with the Web project, it adds the common utility jar file into
> its WEB-INF/lib directory. We tried to change the dependency scope from
> "compile" to "provided". In this case neither the jar was  added nor the
> Class-Path: entry.
>
> How can we specify dependency from the common utility jar file in the war's
> pom file?
>
> Any help is appreciated.  Thanks
>
> Enrique
>
>
>

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


Re: Maven dependency question

Posted by Enrique Gaona <eg...@us.ibm.com>.
I posted this message earlier and didnt get any replies.  Anyone know the
answer:)  Thanks.

Enrique



                                                                           
             Enrique                                                       
             Gaona/Austin/IBM@                                             
             IBMUS                                                      To 
                                       users@maven.apache.org              
             11/14/2006 01:33                                           cc 
             PM                                                            
                                                                   Subject 
                                       Maven dependency question           
             Please respond to                                             
               "Maven Users                                                
                   List"                                                   
             <users@maven.apac                                             
                  he.org>                                                  
                                                                           
                                                                           






Hi folks,

We have a J2EE application project (ear) which contains one Web project
(war), one EJB project and one utilities java project.
The war and EJB jar projects depends from the same utilities project.
We included the WEB, EJB and utilities projects as dependencies into the
ear pom file, so all three output files are included into ear file.
EJB project works as expected it only adds Class-Path: entry into its
Manifest.MF class

The problem with the Web project, it adds the common utility jar file into
its WEB-INF/lib directory. We tried to change the dependency scope from
"compile" to "provided". In this case neither the jar was  added nor the
Class-Path: entry.

How can we specify dependency from the common utility jar file in the war's
pom file?

Any help is appreciated.  Thanks

Enrique