选择显示字体大小

使用ant进行web开发,第二部分

使用ant进行web开发,第二部分

作者:steve holzner

译者:ginger547

e-mail: ginger547@hotmail.com


版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本声明
原文地址:
http://www.onjava.com/pub/a/onjava/excerpt/anttdg_chap8/index1.html
中文地址:
http://www.matrix.org.cn/resource/article/43/43742_ant_web.html
关键词: ant web



编辑语:本文是the definitive guide, 2nd edition的摘录的第二部分,在第一部分中作者steve holzner介绍了如何为web应用程序打包,包括war,cab,ear和jspc。本周他介绍web 应用程序的部署,包括get, serverdeploy和 scp。

使用ant进行web开发,第一部分:
http://www.matrix.org.cn/resource/article/43/43596_ant_web.html

建立简单的web部署

既然已经有了war文件(或 cab文件), 是时候转向web应用程序开发的部署了。如果你工作的机器本身就是一台web服务器,部署将简单到只是把.war文件拷贝到服务器的相应应用程序目录。例 8-2说明了这一点; 这个创建文件建立和拷贝了一个 .war文件到tomcatwebapps 目录.当你(重)启动tomcat,这个.war文件就会被自动释放到一个同名的文件夹下(省去了.war扩展名),同时这个web应用程序也就准备好了,在这个例子中,其url是http://localhost:8080/app (如果你正在部署一个servlet, url将会反映出servlet的包结构,例如http://localhost:8080/org/antbook/ch08/app说明serlet类的结构org.antbook.ch08.app.)。

例 8-2. tomcat部署的创建文件 (ch08/simple/build.xml)

<?xml version=&quot;1.0&quot; encoding = &quot;utf-8&quot;?>

<project default=&quot;main&quot; basedir=&quot;.&quot;>

        <property name=&quot;src&quot; location=&quot;source&quot; />
        <property name=&quot;wardir&quot; location=
        &quot;c:/tomcat/jakarta-tomcat-5.0.19/webapps&quot;/>

        <property name=&quot;warfile&quot; location=&quot;${wardir}/app.war&quot;/>
                 <target name=&quot;main&quot; depends=&quot;war&quot;>
                <echo message=&quot;deploying the web app....&quot;/>

        </target>
                <target name=&quot;war&quot; >
        <war destfile=&quot;${warfile}&quot; webxml=&quot;${src}/app.xml&quot; basedir=&quot;${bin}&quot; />

        </target>

</project>


你可以使用ant的 ftp 任务(查看第4章)来远程地部署到一个web服务器的基础目录下。

使用scp来部署

另一种从ant 1.6开始的有效部署方式是scp,它把一个文件或者fileset从一个运行ssh (译者注:指ssh daemon。daemon- [计] inte.net中用于邮件收发的后台程序) 的远程主机上拷贝 (或者拷贝到远程主机上)。这种方式是一种可选的方式,而且你需要把jsch.jar 放到ant的lib目录下来使用 (你可以从以下地址得到jsch.jar: http://www.jcraft.com/jsch/index.html)。
用这种方式部署起来很方便。例如,下面是一个怎样把一个单独的文件部署到一台远程主机的例子 (任何的主机,除非你明确地设置trust的属性为yes或者true,否则它一定要在你的已知主机 (knownhosts) 列表中):

<scp file=&quot;project.jar&quot;
   todir=&quot;user:password@antmegacorp.com:/home/steven/cgi-bin&quot;/>


你可以明确的使用password属性来设置密码:

<scp file=&quot;project.jar&quot;      
   todir=&quot;user@antmegacorp.com:/home/steven/cgi-bin&quot;&quot;      
   password=&quot;password&quot;/>


如何拷贝一个远程文件到本地机器:

<scp file=&quot;user:password@antmegacorp.com:/home/steven/cgi-bin/project.jar&quot;
   todir=&quot;${archive}&quot;/>


如何利用fileset来拷贝一组文件:

<scp todir=&quot;user:password@antmegacorp.com:
   /home/steven/source&quot;>

    <fileset dir=&quot;${src}&quot;>
        <include name=&quot;**/*.java&quot;/>
    </fileset>
</scp>


例8-3给出了一个完整的利用scp方式来部署的构造文件。(它使用了远程主机的ip地址来代替了命名远程服务器。)

例 8-3. 利用scp (ch08/scp/build.xml)

<?xml version=&quot;1.0&quot; ?>
<project default=&quot;main&quot;>

    <property name=&quot;message&quot; value=&quot;deploying the .jar file.&quot; />

    <property name=&quot;src&quot; location=&quot;source&quot; />
    <property name=&quot;output&quot; location=&quot;bin&quot; />

    <target name=&quot;main&quot; depends=&quot;init, compile, compress, deploy&quot;>
        <echo>
            ${message}
        </echo>
    </target>

      <target name=&quot;init&quot;>
        <mkdir dir=&quot;${output}&quot; />
    </target>
      <target name=&quot;compile&quot;>

        <javac srcdir=&quot;${src}&quot; destdir=&quot;${output}&quot; />
    </target>
      <target name=&quot;compress&quot;>
        <jar destfile=&quot;${output}/project.jar&quot; basedir=&quot;${output}&quot;>

            <include name=&quot;*.class&quot;/>
            <include name=&quot;*.txt&quot;/>
        </jar>
    </target>

    <target name=&quot;deploy&quot;>
        <scp trust=&quot;true&quot;             file=&quot;${output}/project.jar&quot;
               todir=&quot;user:password@000.000.000.000:cgi-bin&quot;/>
    </target>

</project>


这是刚才的构造文件在windows机器上运行时候的样子:

%ant
buildfile: build.xml

init:
    [mkdir] created dir: c:\ant\ch08\scp\bin

compile:
    [javac] compiling 1 source file to c:\ant\ch08\scp\bin

compress:
      [jar] building jar: c:\ant\ch08\scp\bin\project.jar

deploy:
      [scp] connecting to 000.000.000.000
      [scp] sending: project.jar : 664
      [scp] file transfer time: 1.32 average rate: 9502.27 b/s
      [scp] done.

main:
     [echo]
     [echo]             deploying the .jar file.
     [echo]

build successful
total time: 12 seconds


小技巧: 正如在第4章的时候说过的一样,在一个构造文件中对密码和/或用户名的显式编码 (hardcoding-也有人称硬编码) 是一种不好的选择。使用属性会是一种较好的办法,象下面这样:

<scp todir=&quot;${username}:${password}@antmegacorp.com:
   /home/steven/source&quot; ...>


象下面这样把用户名和密码传递给ant:

ant -dusername=steven -dpassword=opensesame

在文件被scp 方式所拷贝的时候,它的unix文件许可并没有被保留(实际上它们得到的是umask许可)。如果你想保留unix许可,用unix下的scp 命令来代替(例如, <execexecutable=&quot;scp&quot; ... >).

表 8-3. scp任务属性




你可以使用fileset 元素来选择一组文件来拷贝;如果你使用了fileset,你就必须为todir属性指定一个值. (fileset 元素只在你拷贝本地文件到远程主机时可用)

部署到tomcat

作为servletjsp的参考web服务器tomcat (可从http://jakarta.apache.org/tomcat/得到),自从它包含了自定义的ant部署方式,就变得更吸引ant开发者。
从你的tomcat5复制文件server/lib/catalina-ant.jar到ant的lib目录来使用那些任务。

tomcat部署任务包括部署, 重新加载,反部署 (卸载); 要使用他们,增加这些taskdef元素(在第11章讨论了) 到你的建造文件:

<taskdef name=&quot;deploy&quot; classname=&quot;org.apache.catalina.ant.deploytask&quot;/> 
<taskdef name=&quot;reload&quot; classname=&quot;org.apache.catalina.ant.reloadtask&quot;/>
<taskdef name=&quot;undeploy&quot; classname=&quot;org.apache.catalina.ant.undeploytask&quot;/>


想使用这些任务, 你需要tomcat管理员权限; 象下面这样编辑conf/tomcat-users.xml为一个用户名增加管理员权限(这里是admin)和口令:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename=&quot;manager&quot;/>
  <role rolename=&quot;role1&quot;/>
  <role rolename=&quot;tomcat&quot;/>

  <user username=&quot;admin&quot; password=&quot;password&quot; roles=&quot;manager&quot;/>
  <user username=&quot;role1&quot; password=&quot;tomcat&quot; roles=&quot;role1&quot;/>

  <user username=&quot;tomcat&quot; password=&quot;tomcat&quot; roles=&quot;tomcat&quot;/>
  <user username=&quot;both&quot; password=&quot;tomcat&quot;
roles=&quot;tomcat,role1&quot;/>

</tomcat-users>


你能像下面这样使用部署任务在ant中部署一个web应用程序到tomcat:

<target name=&quot;install&quot;>

    <deploy url=&quot;${manager.url}&quot;

        username=&quot;${manager.username}&quot;
        password=&quot;${manager.password}&quot;         path=&quot;${app.path}&quot;
        localwar=&quot;file://${build}&quot;/>

</target>


在这里manager.url是tomcat管理器的servlet的url。
servlet的缺省值名字是&ldquo;manager&rdquo;,因此看起来象http://localhost:8080/manager。
app.path属性表示的是这个应用程序应该被部署的上下文路径(通常是&ldquo;/&rdquo;加上你想要在url中联机访问的应用程序的的名字)。
build属性表示的是在你要在什么位置来建立web应用程序,比喻说是tomcatwebapps目录。
如果你已经安装一个应用程序并且想要tomcat认出你最新的java类,使用reload(重新加载任务)代替:

<target name=&quot;reload&quot;>

    <reload url=&quot;${manager.url}&quot;

         username=&quot;${manager.username}&quot;
        
password=&quot;${manager.password}&quot;
         path=&quot;${app.path}&quot;/>

</target>


删掉一个web应用程序, 使用undeploy任务:

<target name=&quot;remove&quot;>

    <undeploy url=&quot;${manager.url}&quot;
        username=&quot;${manager.username}&quot;

      
password=&quot;${manager.password}&quot;
        path=&quot;${app.path}&quot;/>

</target>


部署到tomcat

更平常的情况是,你将不会在你想部署到的服务器上进行你的应用程序的开发。 你可以通过浏览器中的url访问到tomcat管理器的servlet进而达到在一台运行了tomcat的远程主机上部署的目的。
ant中实现这一点你需要get任务,当你把一个url传递给它时它得到一份文件。如果你正在使用java 1.4或更新版本,这个任务支持任何url schema, 包括http:, ftp:, jar:,和 https:。如果你想要下载联机的内容,那么这个任务是较大的,或,如在本例中, 通过urls向联机的代码发布命令。

在开始部署前,这个例子使用get命令修改ant主页并保存成ant.html:

<get src=&quot;http://ant.apache.org/&quot; dest=&quot;ant.html&quot;/>


你能通过传递一个要上传的web应用程序的本地位置给管理器的servlet来实现为tomcat上传web应用程序的目的。
例如,从windows的c:/ant/ch08/app上传一个web应用程序,你将使用这个位置:

file:////c:\ant\ch08\app/

上传一个.war文件, 你在位置的最后加一个!来说明你上传的是一个文件而不是目录的内容,在unix中象下面这样:

jar:file://///ant/ch08/app.war!/
例子8-3展示的是在实践的如何工作。

在这个例子中, 构造文件从c: \ant\deploy\app(org.antbook.ch08.deploy)部署一个web应用程序到tomcat,它包含一个显示&quot;project deployment&quot;的servlet
这是你要传递给的get任务的url来告诉tomcat管理器servlet你想要干什么:

http://localhost:8080/manager/deploy?path=/deployment&amp;
   war=file:////c:\ant\deploy\app/


在例子8-4你能看到如何工作。
例子8-4 部署与get(ch08/get/build.xml)

<?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?>

<project default=&quot;main&quot; basedir=&quot;.&quot;>
    <property name=&quot;tomcat.port&quot; value=&quot;8080&quot; />  
      <property name=&quot;tomcat.username&quot; value=&quot;admin&quot; />  
      <property name=&quot;tomcat.password&quot; value=&quot;password&quot; />  
      <target name=&quot;main&quot; >

    <get src=&quot;http://localhost:8080/manager/deploy?path=/deployment&amp;
      war=file:////c:\ant\deploy\app/&quot;
      dest=&quot;deploy.txt&quot;
      username=&quot;${tomcat.username}&quot;
      password=&quot;${tomcat.password}&quot; />


</target>
    </project>


下面是构造文件在实际中运行时候的样子:

%ant
buildfile: build.xml

main:
      [get] getting: http://localhost:8080/manager/deploy?
          
path=/deployment&war=file:////c:\ant\ch08\get\app/

build successful
total time: 1 second


这是tomcat输出到deploy.txt中的文件内容:

ok - deployed application at context path /deployment

在部署以后, 通过http://localhost:8080/deployment/org.antbook.ch08.deploy显示出部署的servlet,如图8-1。

图 8-1. 部署到tomcat

小技巧: 想要得到tomcat管理servlet上的更多的信息,查看tomcat的manager/html-manager-howto.html

get任务的属性在表8-4列出.
表 8-4. get任务属性


小技巧: &nbsp;当verbose 被设置为true的时候,任务会每接受100k显示一个点(.)。

编译jsps

当部署到服务器时, jspc任务是很有用的。 这个任务运行javaserver pages编译器并且把jsp页变成java源代码,也可以在javac任务中实现。 编译jsp页支持jsp网页的快速调用, 在没有完全的jdk服务器上的部署, 或让你不用部署就可以检查他们网页的语法。 缺省情况下,这个任务使用由tomcat自带的jasper jsp编译器。 拷贝tomcat的jasper-compiler.jar和jasper-runtime.jar文件进ant的lib目录来使用这个任务。 你将需要在ant lib目录下放置由tomcat带来的servlet.jar。

例如, 你有这jsp页面, greeting.jsp:
<html>
  <head>
    <title>creating a greeting</title>
  </head>

  <body>
    <h1>creating a greeting</h1>
    <%
        out.println(&quot;hello from jsp!&quot;);    //display the greeting
     %>
  </body>

</html>


例子8-5显示出怎么编译这jsp成greeting.java
例子8-5 编译jsp页(ch08/jspc/build.xml)

<?xml version=&quot;1.0&quot; ?>

<project default=&quot;main&quot;>

    <property name=&quot;message&quot; value=&quot;compiling the jsp....&quot; />
    <property name=&quot;src&quot; location=&quot;source&quot; />

    <property name=&quot;output&quot; location=&quot;bin&quot; />

    <target name=&quot;main&quot; depends=&quot;init, compile&quot;>

        <echo>
          
${message}
        </echo>
    </target>
      <target name=&quot;init&quot;>
        <mkdir dir=&quot;${output}&quot; />

    </target>
      <target name=&quot;compile&quot;>
        <jspc
srcdir=&quot;${src}&quot;
            destdir=&quot;${output}&quot;
            package=&quot;org.antbook.jsp&quot;

            verbose=&quot;9&quot;>
            <include name=&quot;**/*.jsp&quot; />
        </jspc>
    </target>
  </project>


下面是你在运行构造文件时候所要看到的:

%ant
buildfile: build.xml

init:

compile:
     [jspc] compiling 1 source file to
    /home/steven/ant/ch08/jspc/bin/org/antbook/jsp
  [jasperc] 2004-06-30 02:20:09 - class name is:
greeting
  [jasperc] 2004-06-30 02:20:09 - java filename is:
    /home/steven/ant/ch08/jspc/bin/org/antbook/jsp/greeting.java
  [jasperc] 2004-06-30 02:20:09 - accepted
    org.apache.jasper.compiler.parser$scriptlet at /greeting.jsp(7,4)
  [jasperc] 2004-06-30 02:20:09 - compiling with: -encoding utf8

main:
     [echo]
     [echo]             compiling the jsp....
     [echo]

build successful
total time: 3 seconds


下面是java代码结果greeting.java看起来的样子:

package org.antbook.jsp.;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class greeting extends httpjspbase {

    static {
    }
    public greeting( ) {
    }

    private static boolean _jspx_inited = false;

    public final void _jspx_init( )
    
    throws org.apache.jasper.runtime.jspexception {
    }

    public void _jspservice(httpservletrequest request, httpservletresponse  
        response)
        throws java.io.ioexception, servletexception {

        jspfactory _jspxfactory = null;
        pagecontext pagecontext = null;
        httpsession session = null;
        .
        .
        .
        out.println(&quot;hello from jsp!&quot;);    //display the greeting
        .
.
        .
    }
}


下面是另一个例子,它编译jsp页,检查相关性, 并且使用javac任务为这jsp创建实际的bytecode:

<jspc
    destdir=&quot;temp&quot;
    srcdir=&quot;${src}&quot;
    package=&quot;org.antbook.ch08&quot;>

    <include name=&quot;**/*.jsp&quot; />
</jspc>

<depend
    srcdir=&quot;temp&quot;
    destdir=&quot;${bin}&quot;
    classpath=&quot;lib/app.jar&quot;/>

<javac
    srcdir=&quot;temp&quot;
    destdir=&quot;${bin}&quot;
    classpath=&quot;lib/app.jar&quot; />


在表8-5你能看见jspc任务的属性。
表 8-5. jspc任务的属性


jspc任务是一个基于目录的任务,因此被编的jsp文件用javac任务定位一样的方法定位文件, 它意味着你能使用嵌套元素,例如includes 和 excludes。你能使用嵌套的classpath和classpathref元素, 象嵌套的webapp元素一样。唯一出现在jspc任务中的webapp元素, 指示jsp编译器创建一个全部web应用程序程序。一个webapp元素的属性是basedir属性, 它设置应用程序的根目录。在它下级子目录必须有一个web-inf子目录。如果你使用这元素, 这个任务使用编译器检查所有的相关性。
下面是一个使用webapp的例子:

<jspc
    package=&quot;org.antbook.ch08&quot;>
    <include name=&quot;**/*.jsp&quot; />

  
<webapp basedir=&quot;${ch08}&quot; />
</jspc>


部署至ejb 容器

基本上,部署javabean到企业(ejb) 应用服务器相似于你已经看见的另外的ant部署工程。你能使用这任务来打包并且部署ejb应用。 例如,在例子8-6你会看到一个为jboss服务器开发的构造文件; 构造文件首先创造一个.war文件然后把它打包进一个用来部署的.ear文件。

例8-6 一个jboss ejb构造文件(ch08/ejb/build.xml)

<?xml version=&quot;1.0&quot; ?>
<project default=&quot;main&quot; basedir=&quot;.&quot;>

    <target name=&quot;main&quot; depends=&quot;init,
compile, war, ear&quot;/>

    <target name=&quot;init&quot;>
        <property name=&quot;src&quot; value=&quot;${basedir}/src&quot;/>

        <property name=&quot;bin&quot; value=&quot;${basedir}/output&quot;/>
        <property name=&quot;web&quot; value=&quot;${basedir}/web&quot;/>
        <property name=&quot;descriptors&quot;            
               value=&quot;${basedir}/output/deploymentdescriptors&quot;/>

        <property name=&quot;eardir&quot; value=&quot;${basedir}/output/ear&quot;/>
        <property name=&quot;wardir&quot;
value=&quot;${basedir}/output/war&quot;/>
        <property name=&quot;warfile&quot; value=&quot;app.war&quot;/>

        <property name=&quot;earfile&quot; value=&quot;app.ear&quot;/>
            <mkdir dir=&quot;${wardir}/web-inf&quot;/>
        <mkdir dir=&quot;${wardir}/web-inf/classes&quot;/>

        <mkdir dir=&quot;${eardir}/meta-inf&quot;/>
    </target>
        <target name=&quot;compile&quot;>
        <javac destdir=&quot;${bin}&quot; srcdir=&quot;${src}&quot; includes=&quot;**/*.java&quot; />

    </target>
        <target name=&quot;war&quot;>
        <copy todir=&quot;${wardir}&quot;>
            <fileset dir=&quot;${web}&quot; includes=&quot;**/*.*&quot; />         </copy>

            <copy file=&quot;${descriptors}/web.xml&quot; todir=&quot;${wardir}/web-inf&quot; />
            <copy todir=&quot;${wardir}/web-inf/classes&quot;>
            <fileset dir=&quot;${bin}&quot; includes=&quot;**/*.class&quot; />         </copy>

        <jar jarfile=&quot;${eardir}/${warfile}&quot; basedir=&quot;${wardir}&quot; />
    </target>

    <target name=&quot;ear&quot;>

        <copy file=&quot;${descriptors}/application.xml&quot;
               todir=&quot;${eardir}/meta-inf&quot; />
            <jar jarfile=&quot;${basedir}/${earfile}&quot; basedir=&quot;${eardir}&quot; />

  
</target>
    </project>


这就是全部。尽管这构造文件使用标准的ant任务工作,被构造了进ant的任务使以ear任务开始的ejb应用程序工作更容易。

创建ear文件

创造ear任务是容易的.ear文件并且为在大多数ear需要的application.xml文件做特殊的预备。
它没有强制使用这个任务创造一个.ear文件,但是它能使生活更容易。

在表8-6你能看见这个任务的属性。

小技巧: ear任务是一个有为application.xml的特殊的待遇的对jar任务的扩展。
你可以进行一样的操作,在一个zip或者jar任务中使用prefix(前缀)和fullpath属性。

表8-6 ear任务的属性



从zip任务的扩充的支持属性 prefix, fullpath,和src的zipfileset元素, 在ear任务也同样可以办到。 嵌套的metainf元素规定一个fileset; fileset包括的所有的文件在.ear文件的meta-inf目录的结束。

这个任务允许你使用appxml属性设定从什么地方得到application.xml。 下面是一个创建.ear文件的例子:
<ear destfile=&quot;${output}/app.ear&quot; appxml=&quot;${src}/application.xml&quot;>

    <fileset dir=&quot;${wardir}&quot; includes=&quot;*.war&quot;/>
</ear>


支持热部署

serverdeploy任务被设计成支持热部署 (在部署前你不必关闭服务器) 到ejb- aware的服务器。 你设置action属性为你做见过的属性,像为tomcat 管理器servlet设置使用了的那些: &quot;deploy&quot;, &quot;delete&quot;, 和 &quot;undeploy&quot;。

小技巧: 你可能需要vendor-specific来完成这个工作。

ant提供build-end, 但是你的服务器需要提供ant能连结与并且交往的一套部署工具。
在写这篇文章时, 这个任务仅仅支持weblogic服务器和jonas 2.4开放源代码ejb服务器, 但是对另外的ejb容器的支持应该快被增加。
这个任务有仅仅2属性,在表8-7被列出, 并且要求一些嵌套元素。
&nbsp;
表8-7 serverdeploy任务的属性


generic元素

如果你从服务器生产商得到java类的部署代码,这是一个用于基于java的部署的通用元素。如果有一个厂家特定的元素给serverdeploy使用,那当然使用它;但如果没有,那请使用通generic元素。
在表8-8此元素的属性被列出。

表8-8 generic元素的属性


generic元素支持嵌套的arg和jvmarg元素。下面是一个假定目标web服务器是org.steven.j2ee.config.deploy时,使用generic元素的部署文件的例子:

<serverdeploy action=&quot;deploy&quot; source=&quot;${eardir}/app.ear&quot;>
    <generic classname=&quot;org.steven.j2ee.config.deploy&quot;
        classpath=&quot;${classpath}&quot;
        username=&quot;${user.name}&quot;

        password=&quot;${user.password}&quot;>
        <arg value=&quot;-install&quot;/>
        <jvmarg value=&quot;-mx512m&quot;/>
    </generic>

</serverdeploy>


weblogic元素

weblogic元素用于运行weblogic.deploy部署工具; 此工具的合法的actions包括:deploy, undeploy, list, update, 和 delete.。
在表8-9这些元素的属性被列出。

表8-9 weblogic元素的属性


下面是一个使用这个serverdeploy元素内部的元素来部署weblogic服务器的例子:

<serverdeploy action=&quot;deploy&quot;     source=&quot;${eardir}/app.ear&quot;>

    <weblogic application=&quot;app&quot;
        server=&quot;ff19://server:7001&quot;
        classpath=&quot;${weblogic.home}/lib/weblogic.jar&quot;
        username=&quot;${user.name}&quot;
      
password=&quot;${user.password}&quot;

        component=&quot;appserver,productionserver&quot; />
</serverdeploy>


jonas元素

jonas单元支持部署到jonas (java open application server, java开放应用服务器) 服务器。 jonas部署工具 (org.objectweb.jonas.adm.jonasadmin) 的有效actions有
deploy, undeploy, list 和 update.

在表8-10这元素的这些属性别列出。

表8-10。 jonas元素的属性



小技巧: 如果你准备根据从服务器回应的延期时间来编译一个延期任务,使用ant waitfor任务。 你可以使用sleep任务来实现这个目的。
&nbsp;
jonas单元支持嵌套的classpath, arg,和jvmarg单元。 下面是一个使用serverdeploy部署到一个jonas服务器的例子:

<serverdeploy action=&quot;deploy&quot; source=&quot;${eardir}/app.jar&quot;>
    <jonas server=&quot;jonas5&quot; jonasroot=&quot;${jonas.root}&quot;>
      
<classpath>

            <pathelement path=&quot;${jonas.root}/lib/rmi_jonas.jar&quot;/>
        </classpath>
  
</jonas>
</serverdeploy>



steve holzner是o'reilly出版的 upcoming eclipse: a java developer's guide的作者。


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons