maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: maven-antrun-plugin in interactive mode
Date Tue, 12 Mar 2013 10:45:53 GMT
Please read my answer to a similar question on stack overflow:
http://stackoverflow.com/questions/14725197/reading-properties-file-from-pom-file-in-maven/14727072#14727072

When you use antrun to set properties, you are setting "Mojo injected
properties" to use the terminology of my answer. Such properties are only
available within the scope of the currently executing module and only after
the execution of the injecting mojo. Those properties are not available to
child modules. If you look at the reactor order in the build plan, you will
also probably see that the module you are executing this in is running
after the child modules, so even if you could "trick" maven to make this
available to the child modules, it would be too late in any case


On 12 March 2013 10:24, virg g <06virg@gmail.com> wrote:

> Hi,
> I am using maven-antrun-plugin 1.8 in interactive mode to accept user
> inputs for build version for my project.  i want to use this version to be
> updated in all manifests file of all the jars of my project creates.
> I have added this plugin in the parent pom, which has all the modules to be
> built and also the plugin for jar to add manifest info. But the input
> received from prompt i.e build version, not able to update the manifest
> info from this variable (build version). I getting this value as empty. How
> to make this value available to all the jars while updating manifest info.
> This is my sample code in the parent POM. I dont want to pass these
> parameters as command line arguments which i am able to update manifest
> info. My option is only interactive mode. I have set
> <inherited>false</inherited> without this, it prompts for each jar which
> when it creates. Any help is highly appreciated.
>                                         <plugin>
>                         <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-antrun-plugin</artifactId>
>                         <version>1.7</version>
>                         <executions>
>                             <execution>
>                                 <id>catch-new-version</id>
>                                 <inherited>false</inherited>
>                                 <goals>
>                                     <goal>run</goal>
>                                 </goals>
>                                 <phase>validate</phase>
>                                 <configuration>
>                                     <target>
>
>                                         <input
>                                         message="Please enter the new build
> version : "
>                                         addproperty=build-version" />
>                                     </target>
>
> <exportAntProperties>true</exportAntProperties>
>                                 </configuration>
>                             </execution>
>                                                    </executions>
>                                                </plugin>
>
>                                             <plugin>
>                         <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-jar-plugin</artifactId>
>                         <version>2.3.1</version>
>
> -------------------------------
>                                                 <archive>
>                                 <manifestEntries>
>
> <Release-Test-Label>${build-version}</Release-Test-Label>
>                                 </manifestEntries>
>                             </archive>
>                                                 </plugin>
>
> Thanks
> virg
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message