创建耳朵文件与蚂蚁 [英] Creating an ear-File with ant

查看:147
本文介绍了创建耳朵文件与蚂蚁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的蚂蚁我提到许多网站,我需要到build.xml为我的项目它由
两个模块我有application.xml文件从而重新对应war文件presents

I am new to ant i referred many sites , i need to build.xml for my project which consists of two modules i have application.xml file which represents corresponding war file

所以我的问题是,它足以添加application.xml文件

so my question is it sufficient to add the application.xml file

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

这是否会参照相应的war文件或者我需要编译整个场景,请让我知道。如何解决这个问题。

whether this will refer the corresponding war files or i need to compile the whole scenario please let me know. how solve this.

推荐答案

我不是100%肯定你问什么。

I'm not 100% sure what you're asking.

为了使用&LT;耳朵方式&gt; 任务,你已经需要编译需要的jar和战争

In order to use the <ear> task, you already need to have compiled the required jars and wars.

如果这些罐子和战争已经建成,就简单地把它们在你的&LT;入耳GT; 的任务,因为你在你的例子一样。在的application.xml 必须已经构建你的耳朵之前就已存在。在的application.xml 不建的罐子和战争,你必须做到这一点。

If those jars and wars have already been built, you simply refer to them in your <ear> task as you did in your example. The application.xml must already exist before you build your ear. The application.xml doesn't build the jars and wars, you have to do that.

如果您尚未建成的战争和罐子,你需要做的,第一。的概要的的build.xml 看起来是这样的:

If you haven't already built the wars and jars, you need to do that first. A general outline of a build.xml looks something like this:

<project name="foo" basedir="." default="package">

    <!-- Some standard properties you've defined -->
    <property name="target.dir" value="${basedir}/target"/>
    <property name="xxx" value="yyy"/>
    <property name="xxx" value="yyy"/>
    <property name="xxx" value="yyy"/>

    <!-- Compile properties that allow overrides -->

    <property name="javac.nowarn" value="false"/>
    <property name="javac.listfiles" value="false"/>
    <property name="javac.srcdir" value="source"/>
    <property name="javac.distdir" value="${target.dir}/classes"/>


    <target name="clean"
        description="cleans everything nice and shiny">
        <delete dir="${target.dir}"/>
    </target>

    <target name="compile"
        description="Compiles everything">

        <mkdir dir="${javac.distdir}"/>
        <javac srcdir="${javac.srcdir}"
            destdir="${javac.destdir}"
            [...]
            [...]/>
    </target>

    <target name="package.jar"
        depends="compile"
        description="Package jarfile">

        <jar destfile="${target.dir}/jarname.jar"
            [...]
            [...]/>
    </target>

    <target name="package.jar2"
        depends="compile"
        description="Package jarfile">

        <jar destfile="${target.dir}/jarname2.jar"
            [...]
            [...]/>
    </target>

    <target name="package.war"
        depends="compile"
        description="Package jarfile">

        <war destfile="${target.dir}/jarname.jar"
            [...]
            [...]/>
    </target>

    <target name="package"
        depends="package.jar"
        description="Make the ear">

        <ear destfile="${target.dir}/earfile.ear"
            [...]/>
    </target>
</project>

基本上,它是由一堆的目标的,每个目标做一个任务。你可以有目标依赖于其他目标。例如,这个特殊的的build.xml 将自动运行任务。包任务取决于它取决于编译任务 package.jar 任务。因此,的build.xml 文件将首先调用编译,那么 package.jar ,那么

Basically, it consists of a bunch of targets and each target does one task. You can have targets depend upon other targets. For example, this particular build.xml will automatically run the package task. The package task depends upon the package.jar task which depends upon the compile task. Thus, the build.xml file will first call compile, then package.jar, then package.

要记住的重要事情是,你没有指定事件的顺序。你让蚂蚁的身影说出来,你让蚂蚁搞清楚你需要做什么。比方说,你已经修改Java源文件。蚂蚁知道它有重新编译只有一个文件。它也知道,它可能必须重建包含类文件的jar文件。而且,它就会知道它必须重建耳朵。大多数任务可以计算出来自己了,你不做清洁为每个制作。 (您会注意到清洁目标不是由所谓套餐编译,你必须手动调用它)。

The important thing to remember is that you don't specify the order of the events. You let Ant figure that out, and you let Ant figure out what you need to do. Let's say you've modified a java source file. Ant knows that it has to recompile only that one file. It also knows that it might have to rebuild the jarfile that contains that classfile. And, it then knows it has to rebuild the ear. Most tasks can figure it out on their own, and you don't do a clean for each build. (You notice that the clean target isn't called by package or compile. You have to call it manually).

我推荐的唯一的另一件事是,你尽量保持工作区域的清洁。您创建的任何文件应该被放入 $ {target.dir} 目录。这样,当你做一个清洁,你只需要删除一个目录。

The only other thing I recommend is that you try to keep your work area clean. Any files you create should be put into the ${target.dir} directory. That way, when you do a clean, you only have to delete that one directory.

我希望这回答你的问题。

I hope this answer your question.

这篇关于创建耳朵文件与蚂蚁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆