Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/322.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.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 ear中包含源代码_Java_Ant_Ear - Fatal编程技术网

Java 如何在ant ear中包含源代码

Java 如何在ant ear中包含源代码,java,ant,ear,Java,Ant,Ear,我正在使用ANT build.xml构建一个ear文件,需要在我创建的ear包中包含.java文件。有什么建议吗 下面是我的build.xml <target name="war" depends="compile"> <war destfile="${dist}/${ant.project.name}.war" webxml="${warbasepath}/WebContent/WEB-INF/web.xml"> <li

我正在使用ANT build.xml构建一个ear文件,需要在我创建的ear包中包含.java文件。有什么建议吗

下面是我的
build.xml

    <target name="war" depends="compile">
        <war destfile="${dist}/${ant.project.name}.war" webxml="${warbasepath}/WebContent/WEB-INF/web.xml">
          <lib dir="${lib}" />
          <classes dir="${build}"/>
          <fileset dir="${warbasepath}/WebContent" excludes="**/*.class **/*.jar" /> 
        </war>
    </target>

看一看。它只是JAR任务的一个扩展,所以您可以包含任何您喜欢的内容。​

您可以包括任意文件集:

<ear destfile="${build.dir}/myapp.ear" appxml="${src.dir}/metadata/application.xml">
    <fileset dir="${build.dir}" includes="*.jar,*.war"/>
    <fileset dir="${src.dir}" includes="**/*.java"/>
</ear>


然而,EAR应该只是WAR和ejb JAR的容器,因此您可能应该在其中添加源代码。

您从不包含额外的内容。@Vivek为什么要在可执行文件中包含源代码?源代码可以单独绑定。