You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brett Porter <bp...@f2network.com.au> on 2003/05/20 03:58:33 UTC

jar resources in a war + filtering

Hi,

I was wondering what the thoughts were on copying resources into a WAR 
via war:war or war:webapp.
Currently, java:jar-resources is used which puts it into 
WEB-INF/classes, which in some cases is correct, but many resources 
should be copied into WEB-INF itself.
I'm wondering what the thoughts here are on either:
a) having a special resource type for copying into /WEB-INF
b) restructuring the build so that resources are copied to /WEB-INF by 
default, and putting anything in classes meant having a classes 
subdirectory of your config.

I prefer (b) going forward, but it would break any dependency others 
might have that are using it.

I was also wondering what thoughts have evolved on using filtering 
within the resource framework, rather than requiring postGoals that copy 
the same files a second time with filtering.

Thanks,
Brett

-- 
Web Developer
f2 network ~ everything essential
02 8596 4437


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


RE: jar resources in a war + filtering

Posted by Joe Germuska <Jo...@Germuska.com>.
At 10:45 -0500 5/20/03, Brian Murray wrote:
>The "resources" tag library and its "copy" tag is defined in driver.jelly
>(in the root of maven.jar or, if you have the source, in src/conf)

Thanks.  Now I see that I gave some inaccurate information in my 
earlier message:

At 8:53 -0500 5/20/03, Joe Germuska wrote:
>As I was working out a response, I stumbled across an answer -- each 
>Resource object has a "targetPath" property that you can define, so 
>that you can have one set of resources that copy to 
>${maven.build.dest} and another that builds to another place.  Just 
>add a <targetPath>path/relative/to/basedir</targetPath> element.


targetPath is interpreted relative to a destination provided in the 
call to resources:copy.  So when java:jar-resources starts its thing, 
it passes in ${maven.build.dir}, which means if you used syntax like 
I had above, you'd end up with files in 
${maven.build.dir}/path/relative/to/basedir, (by default, 
target/classes/path/relative/to/basedir), which doesn't really help 
with using POM resources to copy stuff for your webapp.

Would it be worth adding a "properties" object to Resource (like 
Dependency has, I guess by extending BaseObject)?  This would allow 
for more fine grained copying, so you could could have more than one 
kind of resource, and it would give you a place to put in filtering 
instructions too.  I guess backwards compatibility would be kind of 
awkward, but if there's enough to be gained, that could probably be 
worked out...

Joe


-- 
--
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"If nature worked that way, the universe would crash all the time." 
	--Jaron Lanier

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


RE: jar resources in a war + filtering

Posted by Brian Murray <br...@vanderbilt.edu>.
The "resources" tag library and its "copy" tag is defined in driver.jelly
(in the root of maven.jar or, if you have the source, in src/conf)


> -----Original Message-----
> From: Joe Germuska [mailto:Joe@Germuska.com] 
> While we're on the subject, can someone help me dereference the 
> "resources" Jelly namespace?  I can't figure out where 
> "resources:copy" is implemented...




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


Re: jar resources in a war + filtering

Posted by Joe Germuska <Jo...@Germuska.com>.
At 11:58 +1000 5/20/03, Brett Porter wrote:
>Hi,
>
>I was wondering what the thoughts were on copying resources into a 
>WAR via war:war or war:webapp.
>Currently, java:jar-resources is used which puts it into 
>WEB-INF/classes, which in some cases is correct, but many resources 
>should be copied into WEB-INF itself.
>I'm wondering what the thoughts here are on either:
>a) having a special resource type for copying into /WEB-INF
>b) restructuring the build so that resources are copied to /WEB-INF 
>by default, and putting anything in classes meant having a classes 
>subdirectory of your config.
>
>I prefer (b) going forward, but it would break any dependency others 
>might have that are using it.
>
>I was also wondering what thoughts have evolved on using filtering 
>within the resource framework, rather than requiring postGoals that 
>copy the same files a second time with filtering.

As I was working out a response, I stumbled across an answer -- each 
Resource object has a "targetPath" property that you can define, so 
that you can have one set of resources that copy to 
${maven.build.dest} and another that builds to another place.  Just 
add a <targetPath>path/relative/to/basedir</targetPath> element.

see http://maven.apache.org/apidocs/org/apache/maven/project/Resource.html

While we're on the subject, can someone help me dereference the 
"resources" Jelly namespace?  I can't figure out where 
"resources:copy" is implemented...

Personally, I haven't really thought of a syntax for filtering that I 
would want to propose; i suspect that everyone who needs it comes up 
with their own little hack that works, but no one feels like they 
have a great solution.

Joe

-- 
--
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"If nature worked that way, the universe would crash all the time." 
	--Jaron Lanier

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