Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Java assertions in jetty-maven-plugin?

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

like image 394
yegor256 Avatar asked Mar 02 '11 16:03

yegor256


People also ask

What is the Artifactid of the jetty maven plugin?

1.1 The 'groupId' is org. eclipse. jetty , by default, it runs on port 8080, in root context '/'.


1 Answers

Set environment variable MAVEN_OPTS to -ea. Jetty by default runs within Maven process and thus is affected by this setting.

There is also interesting library called Force Assertions which hooks into Java 1.6 compilation process. During compilation all assert cond : detail; are transparently compiled to if (!cond) throw new Assertion(detail); blocks, which means assertions will work always no matter what JVM parameters are. Worth to check.

like image 196
gertas Avatar answered Sep 29 '22 23:09

gertas