You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jeremy Banks <je...@plink.co.nz> on 2010/02/23 01:47:10 UTC

Newbie Question

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-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Newbie Question

Posted by Jeremy Banks <je...@plink.co.nz>.
Thanks for the help Baptiste.

That didn't work but -Darguments=-Pversion did.  Thanks for pointing
me in the right direction.

Cheers

Jeremy Banks

Development Team Lead
BIS²
Level 2
45 Tory Street
PO Box 19204
Wellington
New Zealand

+64 21 686 986



On 23 February 2010 19:31, Baptiste MATHUS <ml...@batmat.net> wrote:
> 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 <je...@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-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
>

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


Re: Newbie Question

Posted by Baptiste MATHUS <ml...@batmat.net>.
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 <je...@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-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


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