0

For a previously defined property <scala.js.opt> I'd like to be able to include it like so in a pom.xml file:

<arg value="${scala.js.opt}"/>

However, this doesn't seem to work. Is it even possible, or are there any workarounds?

The particulars of my specific case is that these are arguments to an executable in the maven-antrun-plugin, should this be easier with my specific case.

Detailed example follows

In master pom file:

<properties>
    <scala.js.opt>fastOptJS</scala.js.opt>
</properties>

Then in child pom file

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.8</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <configuration>
                        <target>
                            <exec executable="cmd.exe"
                                  spawn="true">
                                <arg value="/c"/>
                                <arg value="C:\Program Files (x86)\sbt\bin\sbt.bat"/>
                                 <arg>${scala.js.opt}</arg>
                            </exec>
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

When run using e.g., mvn install, this produces:

org.apache.tools.ant.types.Commandline$Argument doesn't support nested text data ("fastOptJS")
bbarker
  • 11,636
  • 9
  • 38
  • 62
  • Use it like properties used in Maven simply via `${scala.js.opt}`... – khmarbaise Dec 16 '16 at 19:42
  • 1
    This seems to result in: `org.apache.tools.ant.types.Commandline$Argument doesn't support nested text data ("fastOptJS")`, where `fastOptJS` is the value of the property. – bbarker Dec 16 '16 at 20:02
  • Please post exactly what you're trying to do, and in which context this property is used. – Tunaki Dec 16 '16 at 20:48
  • In this case, you'd need to use ``, yes. What was the error you encounted with this? What was the command-line invoked? – Tunaki Dec 16 '16 at 22:53
  • What command are you trying to run @bbarker? – Naman Dec 17 '16 at 02:44
  • @Tunaki No error in this case, more of a silent failure: the output from the maven ant task wasn't run – bbarker Dec 17 '16 at 20:51
  • @nullpointer I'm just running `mvn install`; I am not sure that it matters but this is a spring boot project. I also tried `value="@scala.js.opt@"`, which is the format needed for filters in spring boot, but to no avail: http://stackoverflow.com/questions/36501017/maven-resource-filtering-not-working-because-of-spring-boot-dependency I confirmed that worked for filtering html files in my project using the same property, though. – bbarker Dec 17 '16 at 20:54
  • @Tunaki maybe I should try for more verbose output, but this is all I see that is related to antrun: `[INFO] --- maven-antrun-plugin:1.8:run (default) @ ced2ar3-view --- [INFO] Executing tasks main: [INFO] Executed tasks [INFO] [INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ ced2ar3-view --- ` – bbarker Dec 17 '16 at 21:00

0 Answers0