Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Maven 2 Maven Cobertura Outof记忆错误_Maven 2_Maven_Out Of Memory_Cobertura - Fatal编程技术网

Maven 2 Maven Cobertura Outof记忆错误

Maven 2 Maven Cobertura Outof记忆错误,maven-2,maven,out-of-memory,cobertura,Maven 2,Maven,Out Of Memory,Cobertura,我正在使用Maven site:run生成cobertura代码覆盖率 以下是我对cobertura的pom.xml配置: <reporting> ... <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</a

我正在使用Maven site:run生成cobertura代码覆盖率

以下是我对cobertura的pom.xml配置:

<reporting>
    ...
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.3</version>
        </plugin>
    </plugins>
</reporting>

您是否尝试过类似于导出MAVEN_OPTS=-Xmx1024m(或与您的机器匹配的最高值)的方法

如果您仍然没有足够的内存来运行maven,那么我建议您尝试禁用其他插件,并从测试覆盖范围中排除一些类,以检查这是否真的是内存问题

<plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>cobertura-maven-plugin</artifactId>
 <configuration>
  <instrumentation>
    <ignores>
      <ignore>com.example.boringcode.*</ignore>
    </ignores>
    <excludes>
      <exclude>com/example/dullcode/**/*.class</exclude>
      <exclude>com/example/**/*Test.class</exclude>
    </excludes>
  </instrumentation>
</configuration>
尝试使用fork或通过以下方法增加内存。我不确定它是否适用于cobertura,但似乎适用于junit。来自以下内容的片段:


...
乖巧的


...
...
-Xmx512m-XX:MaxPermSize=256m

在pom.xml中使用此属性:

<project>
...
<build>
...
</build>

<properties>
    <cobertura.maxmem>256M</cobertura.maxmem>
</properties>

</project>

...
...
256M

这是我的MAVEN_选项:-XX:MaxPermSize=512m-Xms128m-Xmx600m(我将其更改为-Xmx1024m,但我收到以下错误:VM初始化期间发生错误,无法为对象堆保留足够的空间,无法创建Java虚拟机。)您好,我尝试过,但问题仍然存在。。。这是我在pom.xml中做的更改:(我排除了最大的包)com/xxx/***Test.class com/xxx/yyy/rating/***。class com/xxx/yyy/common/***。class我知道了!在pom.xml中添加512m解决了我的问题。谢谢大家!我明白了!在pom.xml中添加512m解决了我的问题。谢谢大家,然后考虑投票,接受Jean Philippe Briend的回答。
-Dmaven.cobertura.report.maxmemory=xxx
-Dmaven.cobertura.instrumentation.maxmemory=xxx
<plugin>
...
<configuration>
<forkMode>pertest</forkMode>
</configuration>
</plugin>
<plugin>
...
<configuration>
...
<argLine>-Xmx512m -XX:MaxPermSize=256m</argLine> 
</configuration>
</plugin>
<project>
...
<build>
...
</build>

<properties>
    <cobertura.maxmem>256M</cobertura.maxmem>
</properties>

</project>