Hi Jeremy,

The maven-release-plugin forks to do the release. So I think you have to use
an additional -Dparameters="-Pversion" (See
http://maven.apache.org/plugins/maven-release-plugin/prepare-mojo.html#arguments
).

Be aware I'm not totally sure it will work for profiles since I never needed
it, although I did a lot of releases with this plugin;

Btw, shouldn't this profile be always on? Is there cases where you don't
want to generate this file?

Cheers.

2010/2/23 Jeremy Banks <jer...@plink.co.nz>

> Hi All
>
> I've picked up a system set up by someone else and there's an aspect
> of it that's not quite working properly, which I was hoping someone
> may be able to help me with.
>
> We're building a flex project using maven.  The project has 5 modules.
>
> One of the modules has a profile that uses the maven-antrun-plugin to
> copy a file and then substitute some properties in to it in the
> generate-sources phase.  We are using it to insert the pom version and
> an environment variable containing the subversion revision in to a
> file that reports on the version of the software.
>
> The module in question is building an swc which is a dependency in
> some of the other modules.
>
> What's happening is if I run compile or install or deploy in the
> module in question then the file copy and substitution works.  If
> however I call the release targets (i.e. "mvn release:prepare
> release:perform -Dresume=false -P version") it doesn't work.
>
> If I look at the release repository for the module itself and open up
> the sources.jar I can verify that the substitution hasn't worked, as
> the source file hasn't been updated.
>
> So I guess my question is that in this case it appears that
> generate-sources isn't being called as part of the release targets, is
> this correct?  Any suggestions on how to make what is intended here
> work?
>
> Below is the section of the pom that performs the copy and substitution.
>
> Regards
>
> Jeremy Banks
>
>  <profiles>
>    <profile>
>      <id>version</id>
>      <build>
>        <plugins>
>          <plugin>
>            <artifactId>maven-antrun-plugin</artifactId>
>            <executions>
>              <execution>
>                <id>version</id>
>                <phase>generate-sources</phase>
>                <configuration>
>                  <tasks>
>                   <property name="project_basedir"
> value="${project.basedir}" />
>                    <property name="pom_version" value="${pom.version}" />
>                    <property name="svn_revision"
> value="${env.SVN_REVISION}" />
>                    <copy
> file="${project_basedir}/src/main/flex/net/.../VersionTemplate._as"
> tofile="${project_basedir}/src/main/flex/net/.../Version.as"
> overwrite="true" />
>                    <replace
> file="${project_basedir}/src/main/flex/net/.../Version.as"
> token="%SVNVERSION%" value="${svn_revision}" />
>                    <replace
> file="${project_basedir}/src/main/flex/net/.../Version.as"
> token="%SVNURL%" value="${pom_version}" />
>                  </tasks>
>                </configuration>
>                <goals>
>                  <goal>run</goal>
>                </goals>
>              </execution>
>            </executions>
>          </plugin>
>        </plugins>
>      </build>
>    </profile>
>  </profiles>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Reply via email to