[英]How to add a .jar in build.xml?
I have a java web program that implements a .jar and cannot compile without it. 我有一个实现.jar的java web程序,没有它就无法编译。 I have uploaded all of the files with appropriate directory names, but I do not know how to get the build.xml to know where to find the .jar.
我已经使用适当的目录名称上传了所有文件,但我不知道如何让build.xml知道在哪里找到.jar。 The jar file is in my src/program directory.
jar文件位于我的src / program目录中。 I know I need to use the
<classpath>
tag. 我知道我需要使用
<classpath>
标签。 Do I need to put it in my "compile" target inside of the <javac>
tag? 我需要将它放在
<javac>
标签内的“编译”目标中吗?
<?xml version="1.0" encoding="utf-8"?>
<project name="helloworld" default="compile" basedir=".">
<property name="project.src.dir" value="${basedir}/src"/>
<property name="project.lib.dir" value="${basedir}/src/program"/>
<property name="project.classes.dir" value="${basedir}/classes"/>
<path id="lib.path">
<fileset dir="${project.lib.dir}" includes="**/*.jar"/>
</path>
<target name="compile">
<javac srcdir="${project.src.dir}" includes="**/*.java" destdir="${project.classes.dir}" classpathref="lib.path"/>
</target>
</project>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.