rohanpadhye/JQF

equivalent for argLine from Maven Surefire plugin configuration

enzocardeal opened this issue · 2 comments

Hi,

I saw here #198 that mvn:fuzz runs a different plugin than Surefire.

For testing my application, it depends on --add-opens arguments for running properly. The problem is that on the pom.xml it is passed by argLine on Surefire configuration as follows:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
           <useFile>false</useFile>
           <argLine>
             --add-opens jdk.httpserver/com.sun.net.httpserver=ALL-UNNAMED
             --add-opens java.base/java.lang=ALL-UNNAMED
           </argLine>
        </configuration>
      </plugin>

Is there an alternative way that I can pass it so jqf-plugin will pick it up?

Thanks!

As I mentioned in #198, I don't know of any way for Maven plugins to inherit each other (do let me know if you have an idea). You will have to configure JQF separately from Surefire.

For the specific use case of command-line arguments: JQF does not start up new JVMs unlike Surefire, so you can't provide these args in an XML file. By the time the JQF plugin is loaded, the JVM is already up. So, if you want to provide command-line args to the JVM, you have to do it outside the plugin config. The best way to do so is to set the MAVEN_OPTS environment variable, which gets passed on the JVM that starts with the mvn command. See docs here: https://maven.apache.org/configure.html

Thank you for your swift response.

With the help of the docs you sent, I ended up using a .mvn/jvm.config file for those args.