Skip to content

Commit

Permalink
example of custom argLine
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Jan 2, 2018
1 parent 5623c25 commit 8b1db31
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
16 changes: 16 additions & 0 deletions example.parent/example.plugin2.tests/pom.xml
Expand Up @@ -11,4 +11,20 @@
<artifactId>example.plugin2.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- additionalTestArgLine is set in the parent project with the
Jacoco agent when the jacoco profile is active (and it will be empty when
jacoco profile is not active). This way, you can customize argLine without
overwriting the jacoco agent set by jacoco:prepare-agent. -->
<argLine>${additionalTestArgLine} -DbuildingWithTycho=true</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
Expand Up @@ -10,6 +10,10 @@ public class MyClass2Test {

@Test
public void test() {
// just to show that the argLine is set properly when
// building with Tycho
System.out.println("Building with Tycho? " +
System.getProperty("buildingWithTycho", "false"));
myClass.myMethod();
}

Expand Down
10 changes: 9 additions & 1 deletion example.parent/example.tests.parent/pom.xml
Expand Up @@ -11,7 +11,11 @@
<packaging>pom</packaging>

<properties>
<tycho.testArgLine></tycho.testArgLine>
<!-- this will be overridden in jacoco profile with tycho.testArgLine,
which, in turn, will be set by Jacoco prepare-agent goal. This property can
then be used in argLine for custom tycho-surefire configuration, both when
Jacoco is used and when it is not used. -->
<additionalTestArgLine></additionalTestArgLine>
<jacoco-version>0.7.9</jacoco-version>
</properties>

Expand All @@ -21,6 +25,10 @@
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<!-- This will be set by Jacoco prepare-agent goal -->
<additionalTestArgLine>${tycho.testArgLine}</additionalTestArgLine>
</properties>
<build>
<plugins>
<plugin>
Expand Down

0 comments on commit 8b1db31

Please sign in to comment.