You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ilya Kazakevich <ka...@devexperts.com> on 2010/02/02 11:47:21 UTC
Modules in phase order
Hello,
Is it possible to configure order in wich modules are executed in special
phase?
I have a module and I want it to be run right AFTER "jar:jar" in package
phase.
My first module runs in "prepare-package" phase and does some changes in
some files that should be included in final .jar
My second module should do some cleanup after it, but after .jar file is
created. I can bind to "clean" phase, but I want to do it in package phase,
so I can simply run "mvn package".
That's probably against maven ideology. But I wish there is a way to
accomplish that...
Thanks.
====================
Ilya Kazakevich
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Modules in phase order
Posted by Erlend Hamnaberg <ng...@gmail.com>.
This really sounds like something for maven filtering.
put your file somewhere in src/main/resources
then let the file contain for instance
(xml file)
<foo version="$version">
<bar/>
</foo>
add the following to your pom
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/foo.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>**/foo.xml</exclude>
</excludes>
</resource>
</resources>
</build>
Now maven will look for all string which matches $something (basically
anything that is accessable as a maven property) and filter your file
correctly.
This means that the modified file will be copied, and the file in the source
folder will be left alone..
Is it something like this you need?
Re: Modules in phase order
Posted by Anders Hammar <an...@hammar.net>.
Yes, everything that your build produces/manipulates should be put in the
"target" (don't hardcode this folder name though, use the property) folder.
/Anders
On Tue, Feb 2, 2010 at 14:46, Ilya Kazakevich <ka...@devexperts.com>wrote:
> Hello Anders.
>
> >For everyone's understanding, I assume you mean plugins and not modules?
> Yep, I meant plugins, sorry for this mistake.
>
> >Plugins are executed in the order specified in the (effective) pom.
> Thanks! That could help.
>
> >However, the best approach is most often to not rely on this but try to
> have not dependency on the order of the execution of plugins within a
> phase.
> I understand it. Probably I took a wrong way solve my issue.
>
> >So, in your case you could bind your plugin to the phase after package.
> I wanted my plugin to be run for package phase, because user may call "mvn
> package" only. So, package whould be the last phase in this case.
>
> >That being said, I don't really understand what you're trying to do.
>
> I have a file. I want this file to be updated with special info and
> included
> in result .zip which I create using "maven-assembly-plugin".
> But after it I want my file to be fresh (with out of new info), because I
> really need updated file in .zip but not in project it self.
>
> there is a file named boo with the following line: ' version="$VERSION" '
> I want .zip to contain file boo with ' version="<value of ${my.version}>'''
> But "boo" on my filesystem should be left untouched.
>
> So, my idea was to update this file using "maven-replace-plugin", pack zip
> and revert this file.
>
> But I found better solution:
>
> Copy this file to target folder (using wagon), update it and include in
> .zip.
>
> That works.
>
> Ilya.
>
> -----Original Message-----
> From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] On
> Behalf
> Of Anders Hammar
> Sent: Tuesday, February 02, 2010 2:54 PM
> To: Maven Users List
> Subject: Re: Modules in phase order
>
> For everyone's understanding, I assume you mean plugins and not modules?
>
> Plugins are executed in the order specified in the (effective) pom.
> However,
> the best approach is most often to not rely on this but try to have not
> dependency on the order of the execution of plugins within a phase. So, in
> your case you could bind your plugin to the phase after package.
>
> That being said, I don't really understand what you're trying to do. Why
> are
> you cleaning up during the build process? As it doesn't do any difference
> for the artifact it should go in the clean lifecycle.
>
> /Anders
>
> On Tue, Feb 2, 2010 at 11:47, Ilya Kazakevich
> <ka...@devexperts.com>wrote:
>
> > Hello,
> >
> > Is it possible to configure order in wich modules are executed in
> > special phase?
> >
> > I have a module and I want it to be run right AFTER "jar:jar" in
> > package phase.
> >
> > My first module runs in "prepare-package" phase and does some changes
> > in some files that should be included in final .jar My second module
> > should do some cleanup after it, but after .jar file is created. I can
> > bind to "clean" phase, but I want to do it in package phase, so I can
> > simply run "mvn package".
> >
> > That's probably against maven ideology. But I wish there is a way to
> > accomplish that...
> >
> > Thanks.
> >
> > ====================
> > Ilya Kazakevich
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: Modules in phase order
Posted by Ilya Kazakevich <ka...@devexperts.com>.
Hello Anders.
>For everyone's understanding, I assume you mean plugins and not modules?
Yep, I meant plugins, sorry for this mistake.
>Plugins are executed in the order specified in the (effective) pom.
Thanks! That could help.
>However, the best approach is most often to not rely on this but try to
have not dependency on the order of the execution of plugins within a phase.
I understand it. Probably I took a wrong way solve my issue.
>So, in your case you could bind your plugin to the phase after package.
I wanted my plugin to be run for package phase, because user may call "mvn
package" only. So, package whould be the last phase in this case.
>That being said, I don't really understand what you're trying to do.
I have a file. I want this file to be updated with special info and included
in result .zip which I create using "maven-assembly-plugin".
But after it I want my file to be fresh (with out of new info), because I
really need updated file in .zip but not in project it self.
there is a file named boo with the following line: ' version="$VERSION" '
I want .zip to contain file boo with ' version="<value of ${my.version}>'''
But "boo" on my filesystem should be left untouched.
So, my idea was to update this file using "maven-replace-plugin", pack zip
and revert this file.
But I found better solution:
Copy this file to target folder (using wagon), update it and include in
.zip.
That works.
Ilya.
-----Original Message-----
From: anders.g.hammar@gmail.com [mailto:anders.g.hammar@gmail.com] On Behalf
Of Anders Hammar
Sent: Tuesday, February 02, 2010 2:54 PM
To: Maven Users List
Subject: Re: Modules in phase order
For everyone's understanding, I assume you mean plugins and not modules?
Plugins are executed in the order specified in the (effective) pom. However,
the best approach is most often to not rely on this but try to have not
dependency on the order of the execution of plugins within a phase. So, in
your case you could bind your plugin to the phase after package.
That being said, I don't really understand what you're trying to do. Why are
you cleaning up during the build process? As it doesn't do any difference
for the artifact it should go in the clean lifecycle.
/Anders
On Tue, Feb 2, 2010 at 11:47, Ilya Kazakevich
<ka...@devexperts.com>wrote:
> Hello,
>
> Is it possible to configure order in wich modules are executed in
> special phase?
>
> I have a module and I want it to be run right AFTER "jar:jar" in
> package phase.
>
> My first module runs in "prepare-package" phase and does some changes
> in some files that should be included in final .jar My second module
> should do some cleanup after it, but after .jar file is created. I can
> bind to "clean" phase, but I want to do it in package phase, so I can
> simply run "mvn package".
>
> That's probably against maven ideology. But I wish there is a way to
> accomplish that...
>
> Thanks.
>
> ====================
> Ilya Kazakevich
>
>
>
>
>
> ---------------------------------------------------------------------
> 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: Modules in phase order
Posted by Anders Hammar <an...@hammar.net>.
For everyone's understanding, I assume you mean plugins and not modules?
Plugins are executed in the order specified in the (effective) pom. However,
the best approach is most often to not rely on this but try to have not
dependency on the order of the execution of plugins within a phase. So, in
your case you could bind your plugin to the phase after package.
That being said, I don't really understand what you're trying to do. Why are
you cleaning up during the build process? As it doesn't do any difference
for the artifact it should go in the clean lifecycle.
/Anders
On Tue, Feb 2, 2010 at 11:47, Ilya Kazakevich <ka...@devexperts.com>wrote:
> Hello,
>
> Is it possible to configure order in wich modules are executed in special
> phase?
>
> I have a module and I want it to be run right AFTER "jar:jar" in package
> phase.
>
> My first module runs in "prepare-package" phase and does some changes in
> some files that should be included in final .jar
> My second module should do some cleanup after it, but after .jar file is
> created. I can bind to "clean" phase, but I want to do it in package phase,
> so I can simply run "mvn package".
>
> That's probably against maven ideology. But I wish there is a way to
> accomplish that...
>
> Thanks.
>
> ====================
> Ilya Kazakevich
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>