Java – how to create an ear file using an ant build that contains a specific file?
•
Java
I use eclipse to build an ear file using ants I use OC4J and I want to make sure Orion application XML is included in the build What I currently use but don't work is:
<target name="ear" depends="">
<echo>Building the ear file</echo>
<copy todir="${build.dir}/Meta-INF">
<fileset dir="${conf.dir}" includes="orion-application.xml"/>
</copy>
<ear destfile="${dist.dir}/${ant.project.name}.ear"
appxml="${conf.dir}/application.xml">
<fileset dir="${dist.dir}" includes="*.jar,*.war"/>
</ear>
</target>
What is the right way to add to the ear?
Solution
Ant EAR task
All contents that should enter the meta inf folder should pass through the nested < metainf > file set:
<ear destfile="${dist.dir}/${ant.project.name}.ear"
appxml="${conf.dir}/application.xml">
<Metainf dir="${build.dir/Meta-INF}"/>
<fileset dir="${dist.dir}" includes="*.jar,*.war"/>
</ear>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码
