Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tycho-user] How to have multiple profiles adding to tycho-surefire-plugin's <argLine>?

Hi fellow Tycho users,

I am facing the following problem:

When run under macOS, my tests require the use of -XstartOnFirstThread.
I hence have the following profile:

<profile>
  <id>macos</id>
  <activation>
    <os>
      <family>mac</family>
    </os>
  </activation>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-surefire-plugin</artifactId>
          <configuration>
            <argLine>-XstartOnFirstThread ${tycho.testArgLine}</argLine>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</profile>

Now, running the tests under Java 9 ATM also requires a profile [1]:

<profile>
  <id>jdk9/id>
  <activation>
    <jdk>9</jdk>
  </activation>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-surefire-plugin</artifactId>
          <configuration>
            <argLine>--add-modules=ALL-SYSTEM ${tycho.testArgLine}</argLine>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</profile>

While both profiles are active, when run under Java 9 under macOS (as
help:active-profiles confirms), the <argLine> is not pieced together
correctly; as expected, the latter <argLine> overwrites the former. But
this makes the test fail with an "Invalid thread access" SWTException.

Does anyone know of a trick how to have *two* profiles modify the same
<configuration> child? (I guess, I could always define a *third*
macos+java9 profile.)

Unfortunately, tycho-surefire-plugin uses a String <argLine> rather than
a String[]. Otherwise, one could use @combine.children="append" in the
two profiles to add another <arg> to the <argLine>. Maybe it's worth
changing the tycho-surefire-plugin (albeit maven-surefire-plugin also
has just a single <argLine>)?

Best wishes,

Andreas

[1] <https://dev.eclipse.org/mhonarc/lists/tycho-user/msg07848.html>

-- 
Codetrails GmbH
The best code possible

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940

Attachment: signature.asc
Description: OpenPGP digital signature


Back to the top