Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 包含特定文件时的Ant问题_Java_Ant - Fatal编程技术网

Java 包含特定文件时的Ant问题

Java 包含特定文件时的Ant问题,java,ant,Java,Ant,我不确定如何在这里配置我的ANT任务。 我有这个目录结构。在我的java文件夹中是我的属性文件。 当我称我的“战争”蚂蚁为目标时,我想把它们包括在内 -src -java -com -test -MyClass.java -messages.properties -messages_en_US.properties -web -WEB-INF

我不确定如何在这里配置我的ANT任务。 我有这个目录结构。在我的java文件夹中是我的属性文件。 当我称我的“战争”蚂蚁为目标时,我想把它们包括在内

-src
    -java
        -com
            -test
                -MyClass.java
                -messages.properties
                -messages_en_US.properties
-web
    -WEB-INF
    -index.xhtml
这是我的战蚁目标

<project name="myApp" basedir=".">
    <property name="build.dir" value="${basedir}/build" />
    <property name="src.dir" value="${basedir}/src" />
    <property name="dist.dir" value="${basedir}/dist" />
    <property name="web.folder" value="web" />
    <property file="env.properties" />

    <target name="war" depends="compile">
        <war destfile="dist/${ant.project.name}.war" webxml="${web.folder}/WEB-INF/web.xml">
            <fileset dir="${web.folder}">
            </fileset>
            <classes dir="build/classes"/>
        </war>
    </target>
</project>
我尝试使用include标记,但仍然没有任何进展

<fileset dir="${web.folder}">
    <include name="**" />
</fileset>

有什么我错过的吗?谢谢

您是否尝试了以下方法来获取属性文件

<fileset dir="${src.dir}" includes="**/*.properties"/>

我想这和哈里·乔伊在信中写的差不多

一般来说,如果java源目录中有.properties文件,那么在编译阶段可能应该将它们复制到target/classes目录中

<javac ... />
<copy todir="target/classes">
  <fileset dir="src/java" includes="**/*.properties,**/*.xml" />
</copy>
请注意,在某些情况下,人们会将这些文件分离到一个单独的文件夹中,这是maven中保持文件整洁的默认方法。类似src/resources的东西maven使用src/main/resources

您仍然需要进行上述复制。

在中尝试添加此项
<javac ... />
<copy todir="target/classes">
  <fileset dir="src/java" includes="**/*.properties,**/*.xml" />
</copy>