Ant build.xml:在目标条件中引用路径id

Ant build.xml:在目标条件中引用路径id,ant,build,Ant,Build,使用ant,在我的build.xml中,我有: <path id="build.classpath"> <pathelement location="${maven.repo.local}/org/hibernate/hibernate-entitymanager/3.6.10.Final/hibernate-entitymanager-3.6.10.Final.jar"/> . . . <pathelement locatio

使用ant,在我的build.xml中,我有:

<path id="build.classpath">
    <pathelement location="${maven.repo.local}/org/hibernate/hibernate-entitymanager/3.6.10.Final/hibernate-entitymanager-3.6.10.Final.jar"/>
    .
    .
    .
   <pathelement location="${maven.repo.local}/com/h2database/h2/1.3.174/h2-1.3.174.jar"/>
</path>
我在类路径编译目标中使用它作为refId。另一个目标检查LIB是否已存在,否则将下载它们:

 <target name="checkLibs">
    <condition property="present">
       <and>
             <pathelement location="${maven.repo.local}/org/hibernate/hibernate-entitymanager/3.6.10.Final/hibernate-entitymanager-3.6.10.Final.jar"/>
             .
             .
             .
             <pathelement location="${maven.repo.local}/com/h2database/h2/1.3.174/h2-1.3.174.jar"/> 
       </and>
    </condition>
 </target>
是否有一种方法可以在我的checkLibs目标中引用之前定义的路径结构,而不必在and嵌套条件中再次列出所有lib


谢谢

更好的解决方案是使用ApacheIvy或Maven ANT任务。我个人建议ivy更加灵活,但Maven任务将能够共享Maven本地回购协议。在这两种情况下,您都在为ANT构建使用专用的依赖关系管理器,而不是依靠运气来确保存在正确的jar。@MarkO'Connor此评论无助于回答问题,只是建议另一种方法。无论如何,我不理解你在寻找JAR时的运气,如果它们在那里,就可以了,否则它们会被下载:\@LMG用户正在构建一个到由Maven填充的文件目录结构的固定路径。幸运的是,如果有人试图在另一台机器上运行构建,或者有人清除了本地Maven存储库(这是非常常见的),那么以后可能会遇到一些困难。总之,我建议使用常春藤是善意的,因为看起来用户已经在使用Maven了。