有人碰巧知道是否有一种方法可以将jar库的内容检索到一个单独的jar中-因此它将是
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与groovy插件组合。
<标题> build . xml<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配置将下载分离为构建依赖项和集合要在构建中合并的文件。
<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>
标题>标题>
我真的做了这个决定
<target name="project.archive" depends="project.make, ivy-runtimecahe">
<mkdir dir="${project.build}temp" />
<copy todir="${project.build}temp">
<archives>
<zips >
<restrict >
<path refid="classpath.Runtime" />
<name name="*.jar" />
</restrict>
</zips>
</archives>
</copy>
<jar jarfile="${project.build}${project.archive.name}-${project.version}.jar"
manifest="${basedir}${project.maifest}">
<fileset dir="${project.build}temp" includes="***.class" />
<fileset dir="${project.classes}" includes="***.class" />
<fileset dir="Btlserver" includes="***.xml" />
</jar>
然后我们删除temp -,瞧!
此外,也许你可以建议史密斯在eclipse中使用ivyDE和ant进行多个项目布局??我问过这个问题,但是没有人给出任何建议。悲伤(