2016-12-01 8 views
0

ユニットテストを正常に実行するには、JVMに置き換えられた標準クラスを提供する必要があります。したがって、私はmaven-surefire-pluginの設定を、次の使用:`-Xbootclasspath/p:my.jar`オプションで` jacoco-maven-plugin`を実行するには?

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.19.1</version> 
    <configuration> 
    <skipTests>${skipUTs}</skipTests> 
    <argLine>-Xbootclasspath/p:my.jar</argLine> 
    </configuration> 
</plugin> 

plugin/configuration/argLineは、特別何も追加されません。しかし、私はどのようにジャココに同じことを伝えることができますか? jacocoはconfiguration/argLine :(を持っていない

私のpom.xmlファイルに次のように私はMavenのJaCoCoプラグインを設定している:。

documentation of prepare-agentで述べたように
<plugin> 
    <groupId>org.jacoco</groupId> 
    <artifactId>jacoco-maven-plugin</artifactId> 
    <version>0.7.5.201505241946</version> 
    <configuration> 
    <skip>${skipUTs}</skip> 
    <!-- NO ONE (((((
    <argLine>-Xbootclasspath/p:my.jar</argLine> 
    --> 
    </configuration> 
    <executions> 
    <execution> 
     <id>default-prepare-agent</id> 
     <goals> 
     <goal>prepare-agent</goal> 
     </goals> 
    </execution> 
    <execution> 
     <id>default-report</id> 
     <phase>prepare-package</phase> 
     <goals> 
     <goal>report</goal> 
     </goals> 
    </execution> 
    <execution> 
     <id>default-check</id> 
     <goals> 
     <goal>check</goal> 
     </goals> 
     <configuration> 
     <rules> 
      <rule implementation="org.jacoco.maven.RuleConfiguration"> 
      <element>BUNDLE</element> 
      <limits> 
       <limit implementation="org.jacoco.report.check.Limit"> 
       <counter>COMPLEXITY</counter> 
       <value>COVEREDRATIO</value> 
       <minimum>1.0</minimum> 
       </limit> 
      </limits> 
      </rule> 
     </rules> 
     </configuration> 
    </execution> 
    </executions> 
</plugin> 
+0

[mavenでjacoco JVM argsとsurefire JVM argsを一緒に使用できません](http://stackoverflow.com/questions/23190107/cannot-use-jacoco-jvm-args-and-surefire-jvm-args)トーゲザー・イン・メイヴェン) – Godin

答えて

1

- それは単に使用されているプロパティargLineを設定し、

<properties> 
    <argLine>-your -extra -arguments</argLine> 
</properties> 
<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <configuration> 
    <!-- no argLine here --> 
    </configuration> 
</plugin> 

late property evaluation feature of maven-surefire-plugin使用して::

maven-surefire-pluginによって、あなたは追加の引数を追加するための2つのオプションがあります
<properties> 
    <!-- empty to avoid JVM startup error "Could not find or load main class @{argLine}" in case when jacoco-maven-plugin not executed --> 
    <argLine></argLine> 
</properties> 
<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <configuration> 
    <argLine>@{argLine} -your -extra -arguments</argLine> 
    </configuration> 
</plugin> 
関連する問題