有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Ivy OutOfMemoryIvy:发布期间出错

Ivy将大型(ish)工件上传到我们的内部工件服务器(Artifactory 3.9.2)时,我遇到了一个问题。当我们上传一个400MB的文件时,我们耗尽了Java堆空间,它失败了(从而导致我们的CI构建失败)。我们一直在提高上限,但我们预计一些更大的工件(大小约1GB)将打破我们在大小上的稳步增长

我们正在CentOS7环境中使用Ant 1.10、Ivy 2.4、OpenJSK 1.8.0.141

Ivy as IVY-1197已经记录了这个问题,但它还没有在主干构建中得到修复,所以我想介绍一下解决方法:

The workaround is to always use ivy with commons-httpclient, commons-codec and commons-logging when the use case will involve uploading large files to sites requiring authentication

我想将commons-httpclient, commons-codec, and commons-logging添加到Ivy类路径,以便Ivy在上传工件时使用这些。不幸的是,我正在努力使这项工作。说实话,我是Java世界的新手,类路径是一个陌生的概念;我是一个C++开发人员,自愿修复我们系统的遗留部分。p>

我们通过Ant调用常春藤任务。我们拉入一个ivysettings.xml文件,其相关结构如下所示:

<ivysettings>
    <classpath file="${build-utils.basedir}/ivy.lib/commons-httpclient-3.1.jar"/>
    <classpath file="${build-utils.basedir}/ivy.lib/commons-codec-1.10.jar"/>
    <classpath file="${build-utils.basedir}/ivy.lib/commons-logging-1.2.jar"/>
</ivysettings>

通过在我们的组件之间共享的build-utils.xml文件来拉入ivysettings.xml

<project name="build-utils" xmlns:ivy="antlib:org.apache.ivy.ant">
    <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant">
        <classpath>
            <fileset dir="${build-utils.basedir}/ant.lib">
                <include name="ivy*.jar"/>
            </fileset>
        </classpath>
    </taskdef>

    <ivy:settings file="${build-utils.basedir}/ivysettings.xml"/>

    <target name="convert-POM-to-Ivy" > <!-- description="Convert a POM file to an Ivy file"; additionally verifies that we've pulled in Ivy correctly -->
        <ivy:convertpom pomFile="pom.xml" ivyFile="ivyFileOut.xml" />
    </target>
</project>

我们的每个组件都有一个非常简单的ivy.xml

<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info organisation = "${groupId}" 
          module       = "${artifactId}"
          revision     = "${version}}"/>

    <configurations>
        <include file="ivy-configurations.xml"/>
    </configurations>

    <!-- Some giant artifact -->
    <artifact conf="${conf.el7}" type="tar.bz2" e:classifier="${conf.el7}"/>
    <artifact type="pom"/> 

    <dependencies />
</ivy-module>

如果我运行antechoproperties目标和grep for'类。路径“我得到以下信息:

[echoproperties] 
java.class.path=/usr/share/java/ant.jar\:/usr/share/java/ant-launcher.jar\:/usr/share/java/jaxp_parser_impl.jar\:/usr/share/java/xml-commons-apis.jar\:/usr/lib/jvm/java/lib/tools.jar\:/usr/share/ant/lib/ant-bootstrap.jar\:/usr/share/ant/lib/ant-launcher.jar\:/usr/share/ant/lib/ant.jar
[echoproperties] 
java.class.path.ivy.instance=/usr/share/java/ant.jar\:/usr/share/java/ant-launcher.jar\:/usr/share/java/jaxp_parser_impl.jar\:/usr/share/java/xml-commons-apis.jar\:/usr/lib/jvm/java/lib/tools.jar\:/usr/share/ant/lib/ant-bootstrap.jar\:/usr/share/ant/lib/ant-launcher.jar\:/usr/share/ant/lib/ant.jar

在这个设置中,我仍然存在上传问题,我不确定是否可以验证我使用的是commons-httpclient

有人能提供一些关于如何将罐子放入常春藤类路径的提示吗?我做错了吗?我需要把它放在Ant类路径中吗?如果是这样,有人能给我指出正确的方向吗


共 (0) 个答案