English 中文(简体)
在蚂蚁构建文件中添加第三方 jar 类路径
原标题:Add classpath of third party jar in ant build file

I want to use a third party jar file to be used in my ant project. I guess that I should add something in build.xml file. Actually I want to add Jsoup dependency in my build file. I have read somethings after google search but i could not find out. I already have tried

 <classloader loader="system">
    <classpath>
        <fileset dir="${basedir}" includes="jsoup-1.6.2.jar"/>
    </classpath>
</classloader>

谁能告诉我 我怎么能做到这一点?

最佳回答

Thanks for your reply. But later on I managed to solve the problem. Since this is ant project. There is an ivy.xml so just adding ant dependency of jsoup in ivy.xml works fine.

问题回答

还有一个方法可以让你的javac类病中 增加一个罐子

<javac srcdir="${src}" destdir="${classes}">
    <classpath>
        <pathelement location="jsoup-1.6.2.jar"/>
    </classpath>
</javac>

您也可以定义除 javac 范围以外的类路径( 例如, 在您构建文件的顶层), 然后在 javac 任务中通过 id 来引用它 。





相关问题
Refactor packages in a Jar

I have a requirement that i need to load two versions of a jar at once. To avoid class path collisions I d like to rename the packages of one of the jars. Then in source you could always easily ...

Directory list of JAR file within classpath

The typically method to reference a file contained with a JAR file is to use ClassLoader.getResource. Is there a way to get the contents of a directory within a JAR files (similar to java.io.File....

Including dependencies in a jar with Maven

Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file? I have a project the builds into a single jar file. I want the classes from dependencies to be copied into ...

Jar file resource not available?

My program has the following lines, works fine when run from Netbeans, JButton Button_1=new JButton(new ImageIcon(Phone_Dialer.class.getResource("Dir_Icons/"+"Key_1"+Botton_Color+".gif"))); But ...

Include jar file in Scala interpreter

Is it possible to include a jar file run running the Scala interpreter? My code is working when I compile from scalac: scalac script.scala -classpath *.jar But I would like to be able to include a ...

loading from JAR files during deployment vs development

when i am loading some data into my java program, i usually use FileInputStream. however i deploy the program as a jar file and webstart, so i have to use getRessource() or getRessourceAsStream() to ...

热门标签