我的Eclipse项目具有以下结构:
- |我的项目
|-src
|-build
|-doc
|-lib
在lib中放置我的jar文件。这些文件已添加到Build路径中,其中包含" Add to Buildpath命令"。该项目成功编译。
我想用Ant构建项目,为此我编写了以下xml文件
<project name="ABTestConnector" basedir=".">
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="test.Prova"/>
<property name="lib.dir" value="/lib"/>
<property name="doc.dir" value="/doc"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<path id="class-path">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${classes.dir}">
<classpath refid="class-path"/>
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<fileset dir="${classes.dir}" includes="**/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java jar="${jar.dir}/${ant.project.name}.jar" fork="true"/>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
<target name="doc" depends="clean-build" description="generate javadoc">
<javadoc sourcepath="${src.dir}" destdir="${doc.dir}"/>
</target>
我也试过过fileset:include name =&#34; ** / * .jar&#34; /&gt;
但我仍然得到错误
[javac] /home/bruno/Documenti/TestingEnvironment/EclipseWorkspace/SeleniumABTestConnector_0.0.1/src/driversTod/TodSelenium.java:10: package org.openqa.selenium does not exist
[javac] import org.openqa.selenium.By;
提前谢谢。