You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lukas Bradley <lu...@thrustinteractive.com> on 2010/10/07 14:59:30 UTC

Maven WAR Plugin - Modify/Rename files before WAR

I'm looking to rename a couple of files before the actual WAR package
is created.  For example, if I have a Javascript file named "my.js", I
want to rename it to "my-20100106.js" then do a search and replace on
all references to "my.js" and have them reference the new file.

I would love to use the maven-antrun-plugin, but it doesn't look like
there is a stage where the war plugin would cede control, or allow
something to pre-process the files that have been copied to the target
directory.

I have also tried copying all source to a target/mybuild directory,
processed them as needed, then use the warSourceDirectory parameter to
reference target/mybuild.  However, it appears as if
warSourceDirectory is just the directory that the war plugin copies
src/main/webapp into.

Any ideas or input appreciated.


Lukas

Lukas Bradley . President
678.575.5067 m

Thrust Interactive
http://www.thrustinteractive.com

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


Re: Maven WAR Plugin - Modify/Rename files before WAR

Posted by Vincent Latombe <vi...@gmail.com>.
Hello,

war:war is called during package phase, so at prepare-package phase you have
nothing available. I think the war-plugin should be updated to take that
into account.

A possible workaround is to bind an execution of war:exploded during the
prepare-phase, then you do your stuff with antrun, and finally it is
packaged using war:war.

Vincent

2010/10/7 Jesse Farinacci <ji...@gmail.com>

> Hi Lukas,
>
> On Thu, Oct 7, 2010 at 8:59 AM, Lukas Bradley
> <lu...@thrustinteractive.com> wrote:
> >
> > I would love to use the maven-antrun-plugin, but it doesn't look like
> > there is a stage where the war plugin would cede control, or allow
> > something to pre-process the files that have been copied to the target
> > directory.
>
> The prepare-package phase doesn't get you there? This was introduced
> around 2.1 or so..
>
>
> http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference
>
> -Jesse
>
> --
> There are 10 types of people in this world, those
> that can read binary and those that can not.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Vincent

Re: Maven WAR Plugin - Modify/Rename files before WAR

Posted by Jesse Farinacci <ji...@gmail.com>.
Hi Lukas,

On Thu, Oct 7, 2010 at 8:59 AM, Lukas Bradley
<lu...@thrustinteractive.com> wrote:
>
> I would love to use the maven-antrun-plugin, but it doesn't look like
> there is a stage where the war plugin would cede control, or allow
> something to pre-process the files that have been copied to the target
> directory.

The prepare-package phase doesn't get you there? This was introduced
around 2.1 or so..

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference

-Jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

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


Re: Maven WAR Plugin - Modify/Rename files before WAR

Posted by Olivier Lamy <ol...@apache.org>.
Hi,
You can have a look at http://jira.codehaus.org/browse/MWAR-238.
I'm just an it test before pushing the patch.
So you can test it too :-)



2010/10/7 Lukas Bradley <lu...@thrustinteractive.com>:
> I'm looking to rename a couple of files before the actual WAR package
> is created.  For example, if I have a Javascript file named "my.js", I
> want to rename it to "my-20100106.js" then do a search and replace on
> all references to "my.js" and have them reference the new file.
>
> I would love to use the maven-antrun-plugin, but it doesn't look like
> there is a stage where the war plugin would cede control, or allow
> something to pre-process the files that have been copied to the target
> directory.
>
> I have also tried copying all source to a target/mybuild directory,
> processed them as needed, then use the warSourceDirectory parameter to
> reference target/mybuild.  However, it appears as if
> warSourceDirectory is just the directory that the war plugin copies
> src/main/webapp into.
>
> Any ideas or input appreciated.
>
>
> Lukas
>
> Lukas Bradley . President
> 678.575.5067 m
>
> Thrust Interactive
> http://www.thrustinteractive.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
Olivier
http://twitter.com/olamy
http://www.linkedin.com/in/olamy

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