如何解决pom.xml中的堆大小异常?

时间:2018-12-06 03:57:45

标签: java maven

我的程序可以很好地处理小文件输入,但是当我读取2 GB左右的文件时,由于堆大小空间,我遇到了异常。实际上,我的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>org.example</groupId>
  <artifactId>rdf4j-getting-started</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>HelloRDF4J</name>
  <dependencies>
    <dependency>
        <groupId>org.eclipse.rdf4j</groupId>
        <artifactId>rdf4j-runtime</artifactId>
        <version>2.0M2</version>
    </dependency>
     </dependencies>
  <build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <encoding>utf8</encoding>
            </configuration>
        </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>Convert</mainClass>

                     <arguments>
                        <!--<argument>argument1</argument>-->
                    </arguments>
                </configuration>
            </plugin>

            <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19</version>
        <configuration>
            <argLine>-Xmx1024m</argLine>
        </configuration>
      </plugin>
    </plugins>
</build>
</project>

收到以下异常:

  

[错误]无法在项目rdf4j-getting-started上执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:java(default-cli):执行Java类时发生异常。 null:InvocationTargetException:Java堆空间-> [帮助1]   [错误]   [错误]要查看错误的完整堆栈跟踪,请使用-e开关重新运行Maven。   [错误]使用-X开关重新运行Maven以启用完整的调试日志记录。   [错误]   [ERROR]有关错误和可能的解决方案的详细信息,请阅读以下文章:   [错误] [帮助1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

0 个答案:

没有答案