Jak utworzyć plik EAR z ant build zawierający pewne pliki?

Używam eclipse do tworzenia pliku ucha przy użyciu ant. Używam oc4j i chcę się upewnić, że aplikacja orion.xml jest zawarty w kompilacji. To, czego obecnie używam, ale nie działa, to:

   <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>

Jaki jest właściwy sposób, aby dodać to do ucha?

Author: user149100, 2009-08-12

3 answers

ANT EAR task

Wszystko, co powinno znaleźć się w META-INF folderze powinno być określone poprzez zagnieżdżony <metainf> Zestaw Plików:

<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>
 22
Author: ChssPly76,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2010-12-02 11:17:18

Wypróbuj ten kod:

    <ear destfile="deploy/iapp.ear"
         appxml="workspace/appEAR/EarContent/META-INF/application.xml">
        <fileset file="workspace/appEJB/appEJB.jar" />
        <fileset file="workspace/appWAR/appWAR.war" />
        <zipfileset file="workspace/appLIB/appLIB.jar"
                    prefix="APP-INF/lib" />
        <zipfileset dir="lib/fop" includes="*.jar" prefix="APP-INF/lib" />
        <zipfileset dir="lib/poi" includes="*.jar" prefix="APP-INF/lib" />
        <zipfileset dir="lib/gxt" includes="*.jar" prefix="APP-INF/lib" />          
        <metainf dir="workspace/appEAR/EarContent/META-INF">
            <exclude name="**/application.xml" />
            <exclude name="**/MANIFEST.MF" />
        </metainf>
        <manifest>
            <attribute name="Weblogic-Application-Version"
                       value="${deploy.revision}" />
        </manifest>
    </ear>
 7
Author: sasah,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-02-26 00:10:58

Najpierw zbuduj wojnę używając tego;

Http://ant.apache.org/manual/Tasks/war.html

Niż ucho w tym samym zadaniu Mrówki.

Http://ant.apache.org/manual/Tasks/ear.html

Umieść to w swojej strukturze katalogów java project:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="test_ear" name="myProject">
    <property name="build.dir" value="WebContent"/>
<target name="test_ear">
    <war destfile="C:/projects/test1.war" needxmlfile='false'>
      <fileset dir="${build.dir}" excludes="*build*.xml"/>
    </war>
    <ear destfile="C:/projects/test1EAR.ear" appxml="WebContent/META-INF/application.xml">
      <fileset dir="C:/projects/" includes="*.jar,*.war"/>
    </ear>
</target>
</project>
 5
Author: SmartCoder,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-07-04 06:57:16