【发布时间】:2012-02-16 23:25:09
【问题描述】:
你好,
我无法使用 ant 构建脚本编译我的项目。错误信息:
Ant cannot find symbol...
我阅读了有关创建 build.xml 的信息,但似乎还不够。我的项目目录布局如下:
项目
- 源
- 创
- ...
libarie_with_needed_java.file
- 源
- 客户
- 帮手
如何使用外部参考? Ant 找不到 android jar。 build.xml 文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
==================================================================== -->
<project name="test" default="main" basedir=".">
<!-- ====================================================================
Declare global properties for reuse and control of script
==================================================================== -->
<!-- For project source files -->
<property name="src.dir" location = "src/de/test"/>
<property name="common.link" location = "../test-common/common"/>
<!-- For compiled/output files. -->
<property name="build.dir" location = "build/source"/>
<!-- For class libraries and dependency files. -->
<property name="lib.dir" location = "lib"/>
<property name="sdk.dir" location = "../android-sdk-windows/" />
<!-- ====================================================================
Einstiegspunnkt - Target main
==================================================================== -->
<target name="main" depends="compile" description="getting started">
<echo message="start main target"/>
</target>
<!-- ====================================================================
Übersetzen - Target compile
==================================================================== -->
<target name="compile" depends="init">
<echo message="start compile target"/>
<javac srcdir="${src.dir}" destdir="${build}" debug="on"/>
<classpath refid="classpath"/>
</target>
<!-- ====================================================================
Initialisierungen - Target init
==================================================================== -->
<target name="init" description="create needed directories">
<echo message="start init target"/>
<mkdir dir="${build}"/>
</target>
</project>
我使用来自网站的示例和 Eclipse 生成的文件创建了这个文件。
我已删除以下外部属性文件(以简化问题):
<property file="local.properties" />
<property file="build.properties" />
<property file="default.properties" />
我需要包含来自不同 src 位置的外部 .java 文件。
我需要知道如何复制项目中的外部文件并将所有内容编译在一起。
谢谢, 马塞尔
【问题讨论】: