与常春藤的严厉刺耳 [英] Harsh Jarring with ivy

查看:30
本文介绍了与常春藤的严厉刺耳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人碰巧知道是否有一种方法可以将 jar 库的内容检索到一个 jar 中 - 这样就可以了

Does someone happens to know if there is a way to retrieve the contents of jar libs into one single jar - so that it would be

jar 1 :
     org
       smth
         new.class

jar 2 :
     org
       smth
         also.class

jar 3 :
     org
       another
         otheralso.class

that single jar:
        org
          another
            one.class
          smth
            two class

result jar :
        org
          another
            one.class
            otheralso.class
        smth
           two class
           also.class
           new.class

使用 ivy 和 ant ) 我有一个缓存路径或缓存文件集 )

with ivy and ant ) i have a cachepath or cachefileset )

推荐答案

需要结合ivy和groovy插件.

Need to combine ivy with the groovy plug-in.

<target name="resolve">
    <ivy:resolve/>
    <ivy:cachepath pathid="build.path" conf="build"/>
    <ivy:cachefileset setid="jarfiles" conf="jars"/>
</target>

<target name="combine-jars" depends="resolve">
    <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="build.path"/>

    <!-- 
    Iterate thru each file expanding content into a temp directory
    used to create a new jar
    -->
    <groovy>
    project.references.jarfiles.each {
        ant.unzip(src: it, dest:"build/tmp")
    }
    ant.jar(destfile:"build/newjar.jar", basedir:"build/tmp")
    </groovy>
</target>

ivy.xml

使用ivy配置将下载分离成构建依赖和集合稍后在构建中合并的文件.

ivy.xml

Use ivy configurations to separate downloads into build dependencies and a collection of files to be later combined within the build.

<ivy-module version="2.0">
    <info organisation="org.myspotontheweb" module="demo"/>
    <configurations>
        <conf name="build" description="ANT tasks"/>
        <conf name="jars"  description="Files to be combined"/>
    </configurations>
    <dependencies>
        <!-- build dependencies -->
        <dependency org="org.codehaus.groovy" name="groovy-all" rev="1.8.2" conf="build->default"/>

        <!-- jars dependencies -->
        <dependency org="log4j" name="log4j" rev="1.2.16" conf="jars->default"/>
        <dependency org="commons-lang" name="commons-lang" rev="2.6" conf="jars->default"/>
        ..
        ..
    </dependencies>
</ivy-module>

这篇关于与常春藤的严厉刺耳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆