How to disable assertions in tomee-maven-plugin - What's the precedence of "args"?

155 views Asked by At

I tried to figured out how to disable assertions via the tomee-maven-plugin. By default, the console output of the launched TomEE JVM informs me:

 Command line argument: -ea

Therefore, to disable assertions, I made a good guess and tried -da as args (see below)

<plugin>
            <groupId>org.apache.tomee.maven</groupId>
            <artifactId>tomee-maven-plugin</artifactId>
            <version>${tomee.plugin.version}</version>
            <configuration>
                <tomeeVersion>${tomee.version}</tomeeVersion>
                <tomeeClassifier>plus</tomeeClassifier>
                <debug>false</debug>
                <tomeeHttpPort>8282</tomeeHttpPort>
                <debugPort>5005</debugPort>
                <args>-da</args>
                ....

Good news: Assertions are in fact disabled, however, I'm wondering about args precedence here as the console output still prints:

[main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -da
[main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dtomee.force-reloadable=true
[main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -Dtomee.jsp-development=true
.... some more lines
[main] sun.reflect.DelegatingMethodAccessorImpl.invoke Command line argument: -ea

As you can see -da is printed first and afterwards -ea yet at runtime Assertions are disabled.

My questions are:

  1. How is precende defined in this context?
  2. Is this configuration robust so that -da always has precedence over -ea in this setting?

FYI: Using tomee-7.0.2 at the moment.

1

There are 1 answers

0
Romain Manni-Bucau On

ea will always be just before classpath and the main (Bootstrap) since we try to not override provided values (typically for system properties). Issue here is da != ea so we didn't detect it is the same.