Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a java system property during testing phase

sorry for the dumb question, but I'm really new to maven and I cannot find any answer (I tried, I found something, but I did not understand it ;-) )

The problem is the following:

  • I'm building my (eclipse) RCP APP using tycho
  • My plugins rely on a system property to enable a debug mode (by default it is disabled, and it is enabled by launching the program with "-Ddebug=true" as java argument)
  • I have some tests (packaged as fragment, as suggested everywhere)
  • I want that the system property is set when my tests run

How can I instruct maven to do that?

like image 624
Matteo Avatar asked Apr 01 '26 02:04

Matteo


1 Answers

try

<plugins>
  <plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>tycho-surefire-plugin</artifactId>
    <version>${tycho-version}</version>
    <configuration>
      <systemProperties>
          <key>value</key>
      </systemProperties>
    </configuration>
  </plugin>
</plugins>

like image 182
jsievers Avatar answered Apr 02 '26 21:04

jsievers



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!