Discussion:
[tycho-user] How to have multiple profiles adding to tycho-surefire-plugin's <argLine>?
Andreas Sewe
2018-01-23 16:20:28 UTC
Permalink
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
Dietrich, Christian
2018-01-23 17:05:25 UTC
Permalink
Hi,

what about moving both the modules and the firstthread thing to a property
that is by default empty and set in the profiles. then in the actual
configuration you "merge" them together. >${prop1} ${prop2}
Nick Boldt
2018-01-23 17:45:09 UTC
Permalink
Yes, that's what we do in jbosstools so we can combine properties:

https://github.com/jbosstools/jbosstools-build/blob/master/parent/pom.xml#L306

Profiles set the properties, argline uses the properties, everyone wins.

On Tue, Jan 23, 2018 at 12:05 PM, Dietrich, Christian <
Post by Dietrich, Christian
Hi,
what about moving both the modules and the firstthread thing to a property
that is by default empty and set in the profiles. then in the actual
configuration you "merge" them together. >${prop1} ${prop2}
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
--
Nick Boldt :: http://nick.divbyzero.com
FB, IG, Twitter, G+, LinkedIn, Freenode: @nickboldt
WhatsApp: +1 647 899 9879
Andreas Sewe
2018-01-24 14:42:35 UTC
Permalink
Post by Nick Boldt
https://github.com/jbosstools/jbosstools-build/blob/master/parent/pom.xml#L306
Profiles set the properties, argline uses the properties, everyone wins. 
thanks, Nick and Dietrich.

I've implement this [1] and it works well very.

Best wishes,

Andreas

[1] <https://git.eclipse.org/r/#/c/115967/1/tests/pom.xml>
--
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
Loading...