1

我正在尝试构建一个 Android 应用程序——以前只能使用 Eclipse 构建——使用 ant4Eclipse 来自动化构建。它有两个项目,一个构建为 JAR,另一个是 APK(引用 JAR)。这两个项目都引用了 Android 库。

所需的宏构建过程是:

  1. 构建 JAR 项目(称为 XX)
  2. 将 JAR 项目导出到 APK 项目的 lib 文件夹中
  3. 构建 APK 项目

现在,我只是想让 JAR 构建。我确信我会在第二个项目中遇到更多问题,但是......一次一件事。这是我的build.xml

<project 
      name="XX"

       xmlns:ant4eclipse="antlib:org.ant4eclipse"
       xmlns:antcontrib="antlib:net.sf.antcontrib">

<property environment="env"/>
<property name="workspaceDirectory" value="${basedir}/.." />

<taskdef uri="antlib:net.sf.antcontrib"
         resource="net/sf/antcontrib/antlib.xml" />

<taskdef uri="antlib:org.ant4eclipse"
         resource="org/ant4eclipse/antlib.xml" />

<import file="${env.ANT_HOME}/lib/a4e-jdt-macros.xml"/>

<!-- This is here because ANT found this library reference in my project's .classpath and couldn't find it, so I added it thus -->
<ant4eclipse:jdtClassPathLibrary name="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK">
    <fileset dir="C:\eclipse\eclipse-galileo\plugins">
      <include name="com.android.ide.eclpise.*.jar"/>
    </fileset>
</ant4eclipse:jdtClassPathLibrary >
<!-- I borrowed this from http://stackoverflow.com/questions/5649348/ant4eclipse-examples -->
 <target name="compileAndJar">
    <buildJdtProject workspacedirectory="${workspaceDirectory}" projectname="XX">
      <finish>
        <jar destfile="${jar.dir}/myjar.jar">
          <ant4eclipse:jdtProjectFileSet 
              workspacedirectory="${workspaceDirectory}"
              projectname="${buildJdtProject.project.name}"/>
        </jar>
      </finish>
    </buildJdtProject>
  </target>
</project>

现在这是我运行ant compileAndJar时遇到的错误

BUILD FAILED
C:\dev\Project\Client\Android\XX\build.xml:31: The following error occurred while executing this line:
C:\bin\apache-ant-1.8.2\lib\a4e-jdt-macros.xml:77: The following error occurred while executing this line:
C:\bin\apache-ant-1.8.2\lib\a4e-jdt-macros.xml:133: Reference buildJdtProject.boot.classpath.path not found.

另请注意,我在构建输出中看到了这一点:

 [echo]   - bootclasspath      -> ${buildJdtProject.boot.classpath}
4

0 回答 0