How to include Java statements in plug-maven-plugin?

How to enable claims in jetty-maven-plugin ? By default, they are disabled.

+5
source share
4 answers

Set the environment variable MAVEN_OPTSto -ea. Jetty runs by default in the Maven process and thus affects this setting.

There is also an interesting library called Force Assertions that intercepts the Java 1.6 compilation process. At compile time, everything is assert cond : detail;transparently compiled into blocks if (!cond) throw new Assertion(detail);, which means that statements will always work regardless of the JVM parameters. Worth checking out.

+6
source

Netbeans ( Netbeans 8.0), imo:

nbactions.xml( ):

<actions>
  <action>
    <actionName>CUSTOM-jetty:run</actionName>
    <displayName>jetty:run</displayName>
    <goals>
        <goal>jetty:run</goal>
    </goals>
    <properties>
        <Env.MAVEN_OPTS>-ea</Env.MAVEN_OPTS>
    </properties>
  </action>
</actions>

. : run.

. https://netbeans.org/bugzilla/show_bug.cgi?id=166874

0

If it only runs tests and you use maven-surefire-plugin, use this

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
      <enableAssertions>true</enableAssertions>
    </configuration>
  </plugin>
0
source

All Articles