开发者

Glassfish and Ant

I'm just in search how to deploy my project to the remote Glassfish v.2 server. It's easily could be done by installing Glassfish server on local computer and using as-admin tool but it's开发者_开发问答 just a waste of space, time and recourses... The better way is to use jar files with defined Ant tasks(like you do with Tomcat or GAE), but as i found here it's almost unreal to do this in normal way(only with some cheating)...

Also, as you can see here it's rare bug in Glassfish server(hope it will be fixed in v3)


If the server has a web interface for administration you could try to use Ant POST task to do the deploy.
I did this for Oracle OC4J.


To deploy and undeploy glassfish without glassfish; Take jar and other files from glassfish installed directory and put them into a deployer folder(d:\deployer etc.). The following directory structures and files are needed.

.\bin

.\config
.\config\asenv.bat
.\config\asenv.conf

.\lib
.\lib\admin-cli.jar
.\lib\appserv-ext.jar
.\lib\javaee.jar
.\lib\appserv-admin.jar
.\lib\appserv-launch.jar
.\lib\jmxremote_optional.jar
.\lib\appserv-deployment-client.jar
.\lib\appserv-rt.jar
.\lib\sun-appserv-ant.jar

.\build.properties
.\registry.properties

After that;

in build.xml:

<path id="glassfish.deployer">
        <fileset dir="${deployerPath}/lib">
            <include name="*.jar" />
        </fileset>
    </path>

    <taskdef name="sun-appserv-deploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.DeployTask" classpathref="glassfish.deployer" />

    <taskdef name="sun-appserv-undeploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.UndeployTask" classpathref="glassfish.deployer" />

<sun-appserv-deploy file="{jarFile}" name="{name}" contextroot="{path}" upload="true" force="true" precompilejsp="false" asinstalldir="${deployerPath}">
                    <server host="${server}" user="${user}" passwordfile="${passwordFile}" />
                </sun-appserv-deploy>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜