Maven编译问题:系统资源不足

时间:2014-10-20 04:40:42

标签: java maven jenkins

我知道有很多人面对同样的问题。我正面临使用eclipse使用Maven编译器插件编译它的困难。我几乎尝试了别人建议的所有麻烦。任何帮助都会很棒!

ERROR DETAILS:
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ WebScrapper ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 12 source files to E:\Projects\Workspace\Repos\git\automateon2.0\WebScrapper\target\classes

系统资源不足。有关详细信息,请参阅以下堆栈跟踪。

java.lang.StackOverflowError
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:460)
at com.sun.tools.javac.comp.Attr.visitBinary(Attr.java:2062)
at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1565)

注意:以上4行重复20次

[ERROR] An unknown compilation problem occurred
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project WebScrapper: Compilation failure
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

麻烦与以下内容:

1。尝试在pom.xml中增加maven插件配置节点的内存

<argLine> -Xmx512m -XX:MaxPermSize=256m</argLine> 
MAVEN_OPTS = Xmx512m -XX:MaxPermSize=128m

2。尝试设置和增加MAVEN_OPTS env变量的内存

-Xms1024m -Xmx1024m -XX:MaxPermSize=256m

系统信息:

Windows 7 - 64位|编译插件版本:3.1 |开普勒64

我项目的性质: Maven,TestNG项目,几乎没有java类。我正在使用casperJs框架从网页中删除数据并将其保存在电子表格中。我在我的java类中使用了js代码作为字符串,因为我需要传递Testng参数。我热衷于使用maven编译器,因为我必须在Jenkins中托管它并执行maven命令。如果我尝试使用main方法使用Java编译并且能够使用testng.xml执行我的项目,则能够执行。 例如:

@Test
public static String diceJS(String keyword, String Filepath)
{
    String filepath=Filepath.replace("\\", "/");
    String str="var casper=require('casper').create();"
    +"\n"+"var fs = require('fs');"
    +"\n"+"var key='"+keyword+"';"
    +"\n"+"var x=require('casper').selectXPath;"
::::::::::: THIS IS SAMPLE. THERE IS HUGE STRING THAT I HAVE TO USE :::::::::::     
}

的pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>WebScrapper</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
    <sourceDirectory>src/test/java</sourceDirectory>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration> 
                <source>1.7</source> 
                <target>1.7</target>
                <extraJvmArgs>-Xms768m -Xmx768m</extraJvmArgs> 
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.14</version>
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                </suiteXmlFiles> 
                <systemPropertyVariables>
                    <buildnumber>${build.number}</buildnumber>
                </systemPropertyVariables>
                <properties>

                </properties>
            </configuration> 
        </plugin>
    </plugins>
</build>
<dependencies>
    <dependency>
        <groupId>net.sourceforge.jexcelapi</groupId>
        <artifactId>jxl</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.7</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>10.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-lgpl</artifactId>
        <version>1.4.2</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.3</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>1.0.0</version>
    </dependency>
</dependencies>

1 个答案:

答案 0 :(得分:0)

我得到了相同的错误,但是当我在终端中运行mvn命令时,我得到了构建成功。当我从日食运行时,它说java资源出错了。