English 中文(简体)
阿帕奇特一夫:解决安装装置中的受扶养人
原标题:
  • 时间:2009-05-25 23:28:34
  •  标签:

我有一个问题,那就是,我不得不通过阿帕奇一夫解决非标准文物的建筑。

<<>Problem>:

  • I have dependencies on two artifacts (a.jar and a-lib.jar).
  • The two dependencies come only as part of a single installer (a_installer.jar).
  • The installer can be downloaded, the embedded artifacts themselves not.
  • It s possible to manipulate the installer to unpack the needed dependencies.

<>查询:

  • I have to resolve/download the artifacts during the build (I cannot keep the installer or the extracted artifacts with my code).
  • I cannot use a repository to store the extracted artifacts.
  • Subclassing/Extending Ivy/whatever is perfectly fine.

是否有任何人解决了类似的问题,或有一些有用的信息分享?

或者说,用错误的方式来对待问题可能不会错了吗? 从我迄今为止在网上看到的情况来看,人们似乎只用下载files,然后用人工方式(用Ant/whatever)进行处理,而不是在Ivy范围内实际解决更复杂的dependencies

增 编

PS:我不关心安装装置是否也安装在舱内,但我只想一次下载安装装置(而不是两个附属设施)。

问题回答

要求“ivy:retrieve”的问题是,你还需要在ivy.xml上添加“artifact”标签。 (与URL公司完成),以收回在Maven存放处没有发现的扶养费。

出于两个原因,我不喜欢这样做。

  1. The ivy.xml should just declare your dependencies, not their locations.
  2. Need additonal custom logic in the build.xml to handle the 3rd party package

理想的情况是,决定如何下载各种词汇的存放场所,这就是为什么我喜欢 Pack。 即使我想要的图书馆不设在马文,我也能够召集集体处理。

The following is an example of changing the jreleaseinfo 进入集体依赖的项目(在来源地,我无法在马文找到)

ivy.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0">
    <info organisation="com.myspotontheweb" module="ivy_packager"/>
    <dependencies>
        <dependency org="ch.oscg" name="jreleaseinfo" rev="1.3.0"/>
    </dependencies>
</ivy-module>

宣布2名解决者。 Default is Maven2, the other is a Packager configuised to look local for Directive. (另见Ivy Roundup项目)

ivygings.xml

<ivysettings>
    <settings defaultResolver="maven2"/>
    <resolvers>
        <ibiblio name="maven2" m2compatible="true"/>

        <packager name="repackage" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache">
            <ivy pattern="file:///${basedir}/repository/[organisation]/[module]/[revision]/ivy.xml"/>
            <artifact pattern="file:///${basedir}/repository/[organisation]/[module]/[revision]/packager.xml"/>
        </packager>
    </resolvers>
    <modules>
        <module organisation="ch.oscg" name="jreleaseinfo" resolver="repackage"/>
    </modules>
</ivysettings>

The magic is containing in the "packager" file. At resolve time this will be used to generate an ANT script that both downloads and extracts the required jars. (No need to put this logic into your build.xml)

repository/ch.oscg/jreleaseinfo/1.3.0/ Packager.xml<>

<packager-module version="1.0">

    <property name="name" value="${ivy.packager.module}"/>
    <property name="version" value="${ivy.packager.revision}"/>
    <property name="zipname" value="${name}-${version}"/>

    <resource dest="archive" url="http://sourceforge.net/projects/jreleaseinfo/files/jreleaseinfo/jreleaseinfo%201.3.0/jreleaseinfo-1.3.0.zip/download" sha1="9386d92758e627d04c2480b820731fd538b13a3f" type="zip"/>

    <build>

        <move file="archive/${zipname}/${zipname}.jar" tofile="artifacts/jars/${name}.jar"/>

    </build>
</packager-module>

为减少档案数量,我略去了该模块ivy.xml。 似乎可以选择,除非你要宣布它为许可,以及应当存在于公共存放处的其他属性。

我认为这非常简单: ivy:retrieve a_installer, 然后将a.j和a-lib编入你的校准目录(或你想要的任何地方)。 这应易于与ant打交道?

我不得不问,你提到的阻碍你这样做的 t是否有些复杂。





相关问题
热门标签