常春藤期间常春藤OutOfMemoryError:发布

Kev*_*n K 5 java ant ivy maven

我遇到了Ivy将大型(ish)工件上传到我们的内部工件服务器(Artifactory 3.9.2)的问题.当我们上传一个400MB的文件时,我们用完了Java堆空间而且它失败了(因此我们的CI构建失败了).我们一直在推动上限,但我们预计会有一些明显更大的工件(大小约为1GB),这将破坏我们稳定的大小.

我们在CentOS7环境中使用Ant 1.10,Ivy 2.4,OpenJSK 1.8.0.141.

这个问题已经被Ivy记录为IVY-1197但是它还没有在trunk构建中修复,所以我想把所描述的解决方法:

解决方法是当用例涉及将大文件上传到需要身份验证的站点时,总是将常春藤用于commons-httpclient,commons-codec和commons-logging

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

我们通过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>
Run Code Online (Sandbox Code Playgroud)

ivysettings.xml通过在拉build-utils.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>
Run Code Online (Sandbox Code Playgroud)

我们的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>
Run Code Online (Sandbox Code Playgroud)

如果我运行ant echoproperties目标并为'class.path' 运行grep,我会得到以下结果:

[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
Run Code Online (Sandbox Code Playgroud)

有了这个设置,我仍然有上传的问题,我不知道我是否可以验证我正在使用commons-httpclient.

有人可以提供一些关于如何将jar放入Ivy类路径的提示吗?我做错了,我需要在Ant类路径中使用它吗?如果是这样,有人能指出我正确的方向吗?