assert
Maven を使用してビルドされた Java プログラムがあり、キーワードを有効にする必要があります。理想的には、maven ビルド コマンドでアサーションを有効にしたいと思います。
9565 次
3 に答える
0
JVMに引数を渡すかどうかに応じて実行時にアサーションが有効になるため、アサーションを有効にしてアプリケーションを構築することはできません。-ea
プログラムの実行時にアサーションを有効にする maven exec プラグインの構成を次に示します。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-ea</argument>
<argument>-classpath</argument> <classpath />
<argument>io.mc.validationdemo.App</argument>
</arguments>
</configuration>
</plugin>
于 2017-02-05T10:20:15.740 に答える