Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
建筑a";“肥罐”;在ant中使用ivy而不将JAR复制到lib目录_Ant_Ivy - Fatal编程技术网

建筑a";“肥罐”;在ant中使用ivy而不将JAR复制到lib目录

建筑a";“肥罐”;在ant中使用ivy而不将JAR复制到lib目录,ant,ivy,Ant,Ivy,我感兴趣的是在我的Java项目中构建一个“胖罐子”,Ivy在其中解析依赖关系。对我来说,将引用的jar文件从ivy缓存复制到本地项目似乎是浪费,所以我希望避免这样做。我找到了一个有效的解决方案,但不知道是否有一个稍微简单一点的方法。在下面的代码中,我认为最简单的是zipfileset行可以工作,但它不能工作——jar包含在构建的jar文件中,但它们没有扩展。如果我使用这个部分,它可以正常工作,但是看起来有点额外的麻烦。有没有更干净的方法 <target depends="clean, bu

我感兴趣的是在我的Java项目中构建一个“胖罐子”,Ivy在其中解析依赖关系。对我来说,将引用的jar文件从ivy缓存复制到本地项目似乎是浪费,所以我希望避免这样做。我找到了一个有效的解决方案,但不知道是否有一个稍微简单一点的方法。在下面的代码中,我认为最简单的是zipfileset行可以工作,但它不能工作——jar包含在构建的jar文件中,但它们没有扩展。如果我使用这个部分,它可以正常工作,但是看起来有点额外的麻烦。有没有更干净的方法

<target depends="clean, build" name="jar">
    <ivy:cachefileset setid="Ping.runclasspath" conf="default" />
    <jar destfile="dist/Ping.jar" filesetmanifest="mergewithoutmain">
        <manifest>
            <attribute name="Main-Class" value="${main-class}"/>
            <attribute name="Class-Path" value="."/>
        </manifest>
        <fileset dir="build"/>
        <zipfileset refid="Ping.runclasspath"/>      <--- this does NOT work
        <restrict>                                   <--- this DOES work
           <name name="**/*.class"/>
           <archives>
              <zips>
                 <fileset refid="Ping.runclasspath"/>
              </zips>
           </archives>
        </restrict>
    </jar>
</target>


你试过吗?我不知道它在你的例子中是否真的有效,但它似乎也有类似的存在目的。

我只是在我的一个ant项目中做了同样的事情。Chris建议使用
zipgroupfileset
有效:

<target depends="clean, build" name="jar">
    <ivy:cachefileset setid="Ping.runclasspath" conf="default" />
    <jar destfile="dist/Ping.jar" filesetmanifest="mergewithoutmain">
        <manifest>
            <attribute name="Main-Class" value="${main-class}"/>
            <attribute name="Class-Path" value="."/>
        </manifest>
        <fileset dir="build"/>
        <zipgroupfileset refid="Ping.runclasspath"/>
    </jar>
</target>