java - jar.libs.dir 没有被正确覆盖吗?

标签 java android xml ant

referencing 之后只是一个few other questions ,我发现这些答案都不适用于我的项目。将 jars 放入每个单独模块的/libs 文件夹中,ant 构建正确运行并产生输出。在删除所有/libs 文件夹并在我需要的每个模块中包含一个 ant.properties 文件(又名 build.properties )后,ant 构建已停止工作。

Ant 属性:

# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.

# This file is only used by the Ant script.

# You can use this to override default values such as
#  'source.dir' for the location of your java source folder and
#  'out.dir' for the location of your output folder.

jar.libs.dir=../ExternalJars/libs

构建.xml

<property file="ant.properties" />

<loadproperties srcFile="project.properties" />

<!-- version-tag: 1 -->
 <import file="${sdk.dir}/tools/ant/build.xml" />

<target name="full-debug" depends="debug">
</target>

<target name="full-release" depends="clean,release">
</target>

据我所知,文件编写正确 - 相对于 ant.properties 文件的路径都是正确的,jar 位于它们应该在的位置,模块使用所有正确的类和部分,等等。

想法?

最佳答案

根据其他答案,这是我对 build.xml 脚本实现的,以支持 jar.libs.dir 属性:

<target name="-pre-compile">
    <property name="project.all.jars.path.temp" value="${toString:project.all.jars.path}" />
    <path id="project.all.jars.path">
        <path path="${project.all.jars.path.temp}"/>
        <fileset dir="${jar.libs.dir}">
            <include name="*.jar"/>
        </fileset>
    </path>
</target>

由于使用了 ,它看起来足够安全,即使默认情况下将多个 JAR 文件添加到路径元素也是如此。

关于java - jar.libs.dir 没有被正确覆盖吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11637852/

相关文章:

java - 使用 Eclipse 进行 GWT 客户端调试

android - 如何为单元测试复制调试 Assets

android - cordova/phonegap 图像上传到 Amazon s3

java - 在 ZIP 中搜索具有散列名称的 XML 文件的有效方法

java - 无法解析具有属性的元素列表

c++ - XSD : How to make a polymorphic "list"?

java - ORM:在 Hibernate/JPA 中用 JSON 代替 LOB

java - 作为 Java 配置 Bean 的 Spring HttpRemoting 客户端

java - 多态不就是封装的一个效果吗?

php - 使用远程 php 脚本将 mysqli_query() 发送到 Intranet