Ant

From Resin 3.0

Revision as of 18:39, 22 September 2009 by Emil (Talk | contribs)
Jump to: navigation, search

Contents

resin-jspc

Resin 3.1.5 includes a resin-ant.jar in ${resin.home}/plugins/resin-ant.jar with several useful task:

<project name="test" default="test" basedir=".">
    <property name="resin.home" value="/usr/local/share/resin"/>

    <target name="test">
         <taskdef name="resin-jspc"
                          classname="com.caucho.ant.Jspc">
             <classpath>
                   <fileset dir="${resin.home}">
                       <include name="plugins/resin-ant.jar"/>
                       <include name="lib/*.jar"/>
                   </fileset>
             </classpath>
         </taskdef>

         <resin-jspc rootDirectory="/home/ferg/ws/dist/my-webapp"/>
    </target>

 </project>

Deployment tasks

resin-upload-war

Resin 4.0.2 will include an Ant deploy client that can deploy applications to a Resin cloud.

<?xml version="1.0"?>
<project name="test" default="test" basedir=".">
  <property name="resin.home" value="/usr/share/resin"/>
  <target name="test">
    <taskdef name="resin-upload-war" classname="com.caucho.ant.ResinUploadWar">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-upload-war server="localhost"
                      port="8080"
                      user="admin"
                      password="myadminpass"
                      warFile="cloudapp.war"/>
  </target>
</project>

To deploy an application with a version, use the "version" attribute:

    <resin-upload-war server="localhost"
                      port="8080"
                      user="admin"
                      password="myadminpass"
                      warFile="cloudapp.war"
                      version="1.0"/>

To place an application into another stage before deploying it to production, set the stage attribute:

    <resin-upload-war server="localhost"
                      port="8080"
                      user="admin"
                      password="myadminpass"
                      warFile="cloudapp.war"
                      stage="preview"/>

resin-copy-tag

To copy a tag, use the "resin-copy-tag" task:

<?xml version="1.0"?>
<project name="test" default="test" basedir=".">
  <property name="resin.home" value="/usr/share/resin"/>
  <target name="test">
    <taskdef name="resin-copy-tag" classname="com.caucho.ant.ResinCopyTag">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-copy-tag server="localhost"
                    port="8080"
                    user="admin"
                    password="myadminpass"
                    stage="default"
                    contextRoot="cloudapp"
                    sourceStage="preview"/>
  </target>
</project>

Copying tags can be used to move applications between stages, to affect the "head" version of a webapp, or to change the name of a webapp.

resin-delete-tag

To delete a tag, use the "resin-delete-tag" task:

<?xml version="1.0"?>
<project name="test" default="test" basedir=".">
  <property name="resin.home" value="/usr/share/resin"/>
  <target name="test">
    <taskdef name="resin-delete-tag" classname="com.caucho.ant.ResinDeleteTag">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-delete-tag server="localhost"
                      port="8080"
                      user="admin"
                      password="myadminpass"
                      stage="preview"
                      contextRoot="cloudapp"/>
  </target>
</project>

resin-query-tags

<?xml version="1.0"?>
<project name="test" default="test" basedir=".">
  <property name="resin.home" value="/usr/share/resin"/>
  <target name="test">
    <taskdef name="resin-query-tags" classname="com.caucho.ant.ResinQueryTags">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-query-tags server="localhost"
                      port="8080"
                      user="admin"
                      password="myadminpass"
                      contextRoot="cloudapp"/>
  </target>
</project>
Personal tools