You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Joe Germuska <Jo...@Germuska.com> on 2003/04/08 20:55:42 UTC

Maven idiom for Ant filter files

Hi:

I'm pretty new to developing projects using Maven.  One thing we 
routinely do as part of our build process is filter configuration 
files to set variables pertinent to the deployment stage for which 
we're building.  In Ant we just dynamically construct a filter file 
name (like 'filters-stage.properties') and use it in the copy 
operation.

It seems like there is no idiomatic support for this in Maven.  I see 
a few places where things get filtered, but not like this.

In this case, I've tracked through the code enough to understand that 
the java:jar-resources goal is where I wish things were happening 
differently.  Can I "override" that goal in my own maven.xml?  Or am 
I supposed to do things with a preGoal or postGoal?  Would it make 
sense to add filtering to the resources:copy tag?

Thanks in advance,
	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: Maven idiom for Ant filter files

Posted by Michal Maczka <mm...@interia.pl>.
I submitted the patch sometimes ago (2003-03-08 to Maven Dev List).
Jason promised to look into it but I guess that there is a lot of more
important things,
which anyway will probably make my patch completely broken (I heard that
there are some changes
planned to JellyContext)

Personally I am not a fan of resource processing defined from  POM level.
But this is seem to me a kind of logical consequence that
if you enable to copy resources  it should be also possible to filter the
resources while copying.
In my patch it just one extra line in POM was required per resource set.


Michal

> -----Original Message-----
> From: Joe Germuska [mailto:Joe@Germuska.com]
> Sent: Friday, April 11, 2003 6:57 PM
> To: Maven Users List
> Subject: Re: Maven idiom for Ant filter files
>
>
> >Personally I would just define a postGoal for
> "java:jar-resources" that did
> >the filter copying of all your resources.
>
> Thanks for the suggestion (and the example!)  It still seems to me
> like something which would merit more explicit support, but I'm happy
> to do it this way until more other people speak up, or until I
> understand things well enough to submit an enhancement request and a
> patch...
>
> 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
>
>
> ----------------------------------------------------------------------
> Towarzyski portal INTERIA.PL >>> http://link.interia.pl/f170b
>
>
>


----------------------------------------------------------------------
KLIKNIJ 2 razy TAK >>> http://link.interia.pl/f170d



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


Re: Maven idiom for Ant filter files

Posted by Joe Germuska <Jo...@Germuska.com>.
>Personally I would just define a postGoal for "java:jar-resources" that did
>the filter copying of all your resources.

Thanks for the suggestion (and the example!)  It still seems to me 
like something which would merit more explicit support, but I'm happy 
to do it this way until more other people speak up, or until I 
understand things well enough to submit an enhancement request and a 
patch...

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: Maven idiom for Ant filter files

Posted by Peter Donald <pe...@realityforge.org>.
On Sat, 12 Apr 2003 01:43, Joe Germuska wrote:
> I'm still kind of doubtful that "filterset" should be a first-class
> property of the POM (or of the resources objects that the POM holds),
> but it could probably be a value set in project.properties and tested
> by a process that is about to call ant's copy task.  I'm still
> getting a handle on where the best place for that might be, but more
> experienced Maven users probably have a good idea.

Personally I would just define a postGoal for "java:jar-resources" that did 
the filter copying of all your resources. Then just make sure that any 
resources that need to be filter copied are not copied across by maven by 
excluding them in the resources section if that makes sense.

ie something like

<postGoal name="java:jar-resources">
  <ant:copy todir="..." filter="true">
   <ant:include name="**/blah.conf"/>
   <ant:filterset>
  ...
   </ant:filterset>
  </ant:copy>
</postGoal>

-- 
Cheers,

Peter Donald
*------------------------------------------------------*
| "Religion is what the common people see as true, the |
| wise people see as false, and the rulers see as      |
| useful" --Seneca                                     |
*------------------------------------------------------*


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


Re: Maven idiom for Ant filter files

Posted by di...@multitask.com.au.
Hi Joe,

currently there's no way to easily filter the resources, AFAIK. 

Maybe you could preGoal on java:jar-resources and set up your filter. But 
I don't know if ant has a way of deregistering filters.
--
dIon Gillard, Multitask Consulting
Blog:      http://www.freeroller.net/page/dion/Weblog
Work:      http://www.multitask.com.au


Joe Germuska <Jo...@Germuska.com> wrote on 12/04/2003 01:43:50 AM:

> I hope I'm not being a nag, but this email was received with a 
> deafening silence.  I'm hoping that's just because anyone who might 
> have a good answer overlooked it, but if it's because I asked my 
> question in a totally boneheaded way, please feel free to tell me 
> so...
> 
> I'm still kind of doubtful that "filterset" should be a first-class 
> property of the POM (or of the resources objects that the POM holds), 
> but it could probably be a value set in project.properties and tested 
> by a process that is about to call ant's copy task.  I'm still 
> getting a handle on where the best place for that might be, but more 
> experienced Maven users probably have a good idea.
> 
> Opinions?
> 
> >I'm pretty new to developing projects using Maven.  One thing we 
> >routinely do as part of our build process is filter configuration 
> >files to set variables pertinent to the deployment stage for which 
> >we're building.  In Ant we just dynamically construct a filter file 
> >name (like 'filters-stage.properties') and use it in the copy 
> >operation.
> >
> >It seems like there is no idiomatic support for this in Maven.  I 
> >see a few places where things get filtered, but not like this.
> >
> >In this case, I've tracked through the code enough to understand 
> >that the java:jar-resources goal is where I wish things were 
> >happening differently.  Can I "override" that goal in my own 
> >maven.xml?  Or am I supposed to do things with a preGoal or 
> >postGoal?  Would it make sense to add filtering to the 
> >resources:copy tag?
> 
> -- 
> --
> 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
> 


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


Re: Maven idiom for Ant filter files

Posted by Joe Germuska <Jo...@Germuska.com>.
I hope I'm not being a nag, but this email was received with a 
deafening silence.  I'm hoping that's just because anyone who might 
have a good answer overlooked it, but if it's because I asked my 
question in a totally boneheaded way, please feel free to tell me 
so...

I'm still kind of doubtful that "filterset" should be a first-class 
property of the POM (or of the resources objects that the POM holds), 
but it could probably be a value set in project.properties and tested 
by a process that is about to call ant's copy task.  I'm still 
getting a handle on where the best place for that might be, but more 
experienced Maven users probably have a good idea.

Opinions?

>I'm pretty new to developing projects using Maven.  One thing we 
>routinely do as part of our build process is filter configuration 
>files to set variables pertinent to the deployment stage for which 
>we're building.  In Ant we just dynamically construct a filter file 
>name (like 'filters-stage.properties') and use it in the copy 
>operation.
>
>It seems like there is no idiomatic support for this in Maven.  I 
>see a few places where things get filtered, but not like this.
>
>In this case, I've tracked through the code enough to understand 
>that the java:jar-resources goal is where I wish things were 
>happening differently.  Can I "override" that goal in my own 
>maven.xml?  Or am I supposed to do things with a preGoal or 
>postGoal?  Would it make sense to add filtering to the 
>resources:copy tag?

-- 
--
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