2307

How to retrieve information from antrun back to maven?

How can I get information from maven-antrun-plugin back to Maven script? For example:

[...] <plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <phase>test</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <exec ... resultproperty="foo"> </target> </configuration> </execution> </executions> </build> [...]

I'm interested to use this foo property later in Maven. How to it get out of antrun?

Answer1:

I am not sure if this solution will work, but maybe you can give it a try:

<plugin> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <executions> <execution> <phase>test</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <exec ... resultproperty="foo"> <taskdef name="script" classname="org.apache.tools.ant.taskdefs.optional.Script" classpathref="maven.plugin.classpath" /> <script language="javascript"> <![CDATA[ project.setProperty("foo.mvn", ${foo}); ]]> </script> </target> </configuration> </execution> </executions> <dependencies> <!-- Needed to run script (of Javascript) task. --> <dependency> <groupId>ant</groupId> <artifactId>ant-optional</artifactId> <version>1.5.1</version> </dependency> <dependency> <groupId>bsf</groupId> <artifactId>bsf</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>rhino</groupId> <artifactId>js</artifactId> <version>1.6R5</version> </dependency> <dependency> <groupId>ant-contrib</groupId> <artifactId>ant-contrib</artifactId> <version>1.0b3</version> <scope>runtime</scope> </dependency> </dependencies> </plugin>

The idea is to use define a property available for Maven (called here foo.mvn) by using the project.setProperty("foo.mvn", ${foo});. I am using JavaScript here, so you need to add some dependencies in the antrun plugin to be able to run it...

Recommend

  • Avoid Inheriting Super Class Tests in ScalaTest
  • CSS how to fix an element to scroll horizontally with the page but not vertically?
  • Portable JRE on Linux - possible?
  • Can my PDF ping my server when it is opened?
  • Django model for a Postgres view
  • Spring Cloud Microservice Architecture Confusion
  • Automatically associate new Sonar project with custom quality profile and quality gate
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Jetty 9 HashLoginService
  • Installing Apache MyFaces 2 on WildFly 8.2.0
  • Database structure design with variable amounts of fields
  • Meteor helpers not available in Angular template
  • Read a local file using javascript
  • How to install a .deb file on a jailbroken iphone programmatically?
  • ImageMagick, replace semi-transparent white with opaque white
  • Cannot connect to cassandra from Spark
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • How can I send an e-mail from a vbs script
  • How do I fake an specific browser client when using Java's Net library?
  • How to get a value (ex: baseURL) in every Karate feature?
  • Cross-Platform Protobuf Serialization
  • Shallow update not allowed (git > 1.9)
  • Convert array of 8 bytes to signed long in C++
  • Build own AppleScript numerical error handling
  • jquery mobile loadPage not working
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • Is there a mandatory requirement to switch app.yaml?
  • How to include full .NET prerequisite for Wix Burn installer
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Qt: Run a script BEFORE make
  • Checking variable from a different class in C#
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF