You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "SACHIN :)" <mi...@hotmail.com> on 2010/08/17 06:26:50 UTC
Maven war build ignores resources folder
Hi
I am new to maven and currently stuck so any help will be appreciated.
I have a Maven web-app project and I need to build a jar file, which then gets included in the war. I got this to work by using the <archiveClass>true</archiveClass> for the war plugin.
However, my resources folder content is no longer available on the class path ie. /WEB-INF/classes/ is empty in the war file.
how can I get the resources folder content in the war WEB-INF/classes/ SO THAT they are available in the classpath? These are some xml config files.
target/classes content is as expected but only when the war file is build the xml config files disappers!
Thanks
RE: Maven war build ignores resources folder
Posted by "Jankiraman, Radhakrishnan" <rj...@emptoris.com>.
Just to clarify. WEB-INF/classes will include both compiled classes and resources. So between WEB-INF/classes and jars under WEB-INF/lib there is no difference both are in the web app class path. To me it seems that the reason you want to package your classes/resources into jar first and then put it into WEB-INF/lib is that you want to distribute this jar for other purposes. And this is where multi module projects come in.
-Rk
-----Original Message-----
From: Jankiraman, Radhakrishnan
Sent: Tuesday, August 17, 2010 5:59 PM
To: 'Maven Users List'
Subject: RE: Maven war build ignores resources folder
By default classes would be automatically included in the WEB-INF/classes. So why would you want to package it as a jar and then include in WEB-INF/lib ? Does it matter how the classes are packaged in the war ? If you are looking to make this jar available for other purposes, then this code is re-usable and shouldn't be part of the war codebase. You might want to take a look at multi module projects and set up a separate maven project for these classes and then included that project as a dependency for your war project.
-Rk
-----Original Message-----
From: SACHIN :) [mailto:mishra_sachin@hotmail.com]
Sent: Tuesday, August 17, 2010 5:08 PM
To: Maveb Users
Subject: RE: Maven war build ignores resources folder
Hi
Yes, you are correct Jeff, the resources content ends up in the jar file under WEB-INF/lib.
Is it a way to exclude the resources content from the jar and put it in the WEB-INF/classes WHEN the war is build?
Thanks
Sachin
> From: jeffmaury@jeffmaury.com
> Date: Tue, 17 Aug 2010 10:32:06 +0200
> Subject: Re: Maven war build ignores resources folder
> To: users@maven.apache.org
>
> Because you set archiveClasses to true, I suspect your resources files are
> in the JAR created. Take a look at WEB-INF/lib instead.
>
> Regards
> Jeff MAURY
>
> On Tue, Aug 17, 2010 at 6:26 AM, SACHIN :) <mi...@hotmail.com>wrote:
>
> >
> > Hi
> >
> > I am new to maven and currently stuck so any help will be appreciated.
> >
> > I have a Maven web-app project and I need to build a jar file, which then
> > gets included in the war. I got this to work by using the
> > <archiveClass>true</archiveClass> for the war plugin.
> >
> > However, my resources folder content is no longer available on the class
> > path ie. /WEB-INF/classes/ is empty in the war file.
> >
> > how can I get the resources folder content in the war WEB-INF/classes/ SO
> > THAT they are available in the classpath? These are some xml config files.
> >
> >
> > target/classes content is as expected but only when the war file is build
> > the xml config files disappers!
> >
> > Thanks
> >
>
>
>
>
> --
> "Legacy code" often differs from its suggested alternative by actually
> working and scaling.
> - Bjarne Stroustrup
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
> http://www.twitter.com/jeffmaury
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven war build ignores resources folder
Posted by Jeff MAURY <je...@jeffmaury.com>.
Maybe you can try to configure your resources folder as a WebResource in the
plugin configuration. See
http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#webResourcesfor
more info.
Regards
Jeff MAURY
On Tue, Aug 17, 2010 at 1:38 PM, SACHIN :) <mi...@hotmail.com>wrote:
>
> Hi
>
> Yes, you are correct Jeff, the resources content ends up in the jar file
> under WEB-INF/lib.
>
> Is it a way to exclude the resources content from the jar and put it in the
> WEB-INF/classes WHEN the war is build?
>
> Thanks
> Sachin
>
>
> > From: jeffmaury@jeffmaury.com
> > Date: Tue, 17 Aug 2010 10:32:06 +0200
> > Subject: Re: Maven war build ignores resources folder
> > To: users@maven.apache.org
> >
> > Because you set archiveClasses to true, I suspect your resources files
> are
> > in the JAR created. Take a look at WEB-INF/lib instead.
> >
> > Regards
> > Jeff MAURY
> >
> > On Tue, Aug 17, 2010 at 6:26 AM, SACHIN :) <mishra_sachin@hotmail.com
> >wrote:
> >
> > >
> > > Hi
> > >
> > > I am new to maven and currently stuck so any help will be appreciated.
> > >
> > > I have a Maven web-app project and I need to build a jar file, which
> then
> > > gets included in the war. I got this to work by using the
> > > <archiveClass>true</archiveClass> for the war plugin.
> > >
> > > However, my resources folder content is no longer available on the
> class
> > > path ie. /WEB-INF/classes/ is empty in the war file.
> > >
> > > how can I get the resources folder content in the war WEB-INF/classes/
> SO
> > > THAT they are available in the classpath? These are some xml config
> files.
> > >
> > >
> > > target/classes content is as expected but only when the war file is
> build
> > > the xml config files disappers!
> > >
> > > Thanks
> > >
> >
> >
> >
> >
> > --
> > "Legacy code" often differs from its suggested alternative by actually
> > working and scaling.
> > - Bjarne Stroustrup
> >
> > http://www.jeffmaury.com
> > http://riadiscuss.jeffmaury.com
> > http://www.twitter.com/jeffmaury
>
>
--
"Legacy code" often differs from its suggested alternative by actually
working and scaling.
- Bjarne Stroustrup
http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury
RE: Maven war build ignores resources folder
Posted by "Jankiraman, Radhakrishnan" <rj...@emptoris.com>.
By default classes would be automatically included in the WEB-INF/classes. So why would you want to package it as a jar and then include in WEB-INF/lib ? Does it matter how the classes are packaged in the war ? If you are looking to make this jar available for other purposes, then this code is re-usable and shouldn't be part of the war codebase. You might want to take a look at multi module projects and set up a separate maven project for these classes and then included that project as a dependency for your war project.
-Rk
-----Original Message-----
From: SACHIN :) [mailto:mishra_sachin@hotmail.com]
Sent: Tuesday, August 17, 2010 5:08 PM
To: Maveb Users
Subject: RE: Maven war build ignores resources folder
Hi
Yes, you are correct Jeff, the resources content ends up in the jar file under WEB-INF/lib.
Is it a way to exclude the resources content from the jar and put it in the WEB-INF/classes WHEN the war is build?
Thanks
Sachin
> From: jeffmaury@jeffmaury.com
> Date: Tue, 17 Aug 2010 10:32:06 +0200
> Subject: Re: Maven war build ignores resources folder
> To: users@maven.apache.org
>
> Because you set archiveClasses to true, I suspect your resources files are
> in the JAR created. Take a look at WEB-INF/lib instead.
>
> Regards
> Jeff MAURY
>
> On Tue, Aug 17, 2010 at 6:26 AM, SACHIN :) <mi...@hotmail.com>wrote:
>
> >
> > Hi
> >
> > I am new to maven and currently stuck so any help will be appreciated.
> >
> > I have a Maven web-app project and I need to build a jar file, which then
> > gets included in the war. I got this to work by using the
> > <archiveClass>true</archiveClass> for the war plugin.
> >
> > However, my resources folder content is no longer available on the class
> > path ie. /WEB-INF/classes/ is empty in the war file.
> >
> > how can I get the resources folder content in the war WEB-INF/classes/ SO
> > THAT they are available in the classpath? These are some xml config files.
> >
> >
> > target/classes content is as expected but only when the war file is build
> > the xml config files disappers!
> >
> > Thanks
> >
>
>
>
>
> --
> "Legacy code" often differs from its suggested alternative by actually
> working and scaling.
> - Bjarne Stroustrup
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
> http://www.twitter.com/jeffmaury
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Maven war build ignores resources folder
Posted by "SACHIN :)" <mi...@hotmail.com>.
Hi
Yes, you are correct Jeff, the resources content ends up in the jar file under WEB-INF/lib.
Is it a way to exclude the resources content from the jar and put it in the WEB-INF/classes WHEN the war is build?
Thanks
Sachin
> From: jeffmaury@jeffmaury.com
> Date: Tue, 17 Aug 2010 10:32:06 +0200
> Subject: Re: Maven war build ignores resources folder
> To: users@maven.apache.org
>
> Because you set archiveClasses to true, I suspect your resources files are
> in the JAR created. Take a look at WEB-INF/lib instead.
>
> Regards
> Jeff MAURY
>
> On Tue, Aug 17, 2010 at 6:26 AM, SACHIN :) <mi...@hotmail.com>wrote:
>
> >
> > Hi
> >
> > I am new to maven and currently stuck so any help will be appreciated.
> >
> > I have a Maven web-app project and I need to build a jar file, which then
> > gets included in the war. I got this to work by using the
> > <archiveClass>true</archiveClass> for the war plugin.
> >
> > However, my resources folder content is no longer available on the class
> > path ie. /WEB-INF/classes/ is empty in the war file.
> >
> > how can I get the resources folder content in the war WEB-INF/classes/ SO
> > THAT they are available in the classpath? These are some xml config files.
> >
> >
> > target/classes content is as expected but only when the war file is build
> > the xml config files disappers!
> >
> > Thanks
> >
>
>
>
>
> --
> "Legacy code" often differs from its suggested alternative by actually
> working and scaling.
> - Bjarne Stroustrup
>
> http://www.jeffmaury.com
> http://riadiscuss.jeffmaury.com
> http://www.twitter.com/jeffmaury
Re: Maven war build ignores resources folder
Posted by Jeff MAURY <je...@jeffmaury.com>.
Because you set archiveClasses to true, I suspect your resources files are
in the JAR created. Take a look at WEB-INF/lib instead.
Regards
Jeff MAURY
On Tue, Aug 17, 2010 at 6:26 AM, SACHIN :) <mi...@hotmail.com>wrote:
>
> Hi
>
> I am new to maven and currently stuck so any help will be appreciated.
>
> I have a Maven web-app project and I need to build a jar file, which then
> gets included in the war. I got this to work by using the
> <archiveClass>true</archiveClass> for the war plugin.
>
> However, my resources folder content is no longer available on the class
> path ie. /WEB-INF/classes/ is empty in the war file.
>
> how can I get the resources folder content in the war WEB-INF/classes/ SO
> THAT they are available in the classpath? These are some xml config files.
>
>
> target/classes content is as expected but only when the war file is build
> the xml config files disappers!
>
> Thanks
>
--
"Legacy code" often differs from its suggested alternative by actually
working and scaling.
- Bjarne Stroustrup
http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury