Ant

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
(added new deploy tasks)
(updated deploy tasks)
Line 22: Line 22:
 
   </project>
 
   </project>
  
== resin-deploy ==
+
= Deployment tasks =
  
Resin 4 will include an Ant deploy client that can deploy applications to a Resin cloud.
+
== 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"?>
 
  <?xml version="1.0"?>
Line 30: Line 32:
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <target name="test">
 
   <target name="test">
     <taskdef name="resin-deploy-war" classname="com.caucho.ant.ResinDeployWar">
+
     <taskdef name="resin-upload-war" classname="com.caucho.ant.ResinUploadWar">
 
       <classpath>
 
       <classpath>
 
         <fileset dir="${resin.home}">
 
         <fileset dir="${resin.home}">
Line 39: Line 41:
 
     </taskdef>
 
     </taskdef>
 
   
 
   
     <resin-deploy-war server="localhost"
+
     <resin-upload-war server="localhost"
 
                       port="8080"
 
                       port="8080"
 
                       user="admin"
 
                       user="admin"
Line 48: Line 50:
  
 
To deploy an application with a version, use the "version" attribute:
 
To deploy an application with a version, use the "version" attribute:
     <resin-deploy-war server="localhost"
+
     <resin-upload-war server="localhost"
 
                       port="8080"
 
                       port="8080"
 
                       user="admin"
 
                       user="admin"
Line 55: Line 57:
 
                       version="1.0"/>
 
                       version="1.0"/>
  
To stage an application before deploying it to production, set the staging attribute:
+
To place an application into another stage before deploying it to production, set the stage attribute:
     <resin-deploy-war server="localhost"
+
     <resin-upload-war server="localhost"
 
                       port="8080"
 
                       port="8080"
 
                       user="admin"
 
                       user="admin"
 
                       password="myadminpass"
 
                       password="myadminpass"
 
                       warFile="cloudapp.war"
 
                       warFile="cloudapp.war"
                       staging="true"/>
+
                       stage="preview"/>
  
== resin-unstage ==
+
== resin-copy-tag ==
To move an application from a staged state to a production state, use the "resin-unstage" task:
+
To copy a tag, use the "resin-copy-tag" task:
  
 
  <?xml version="1.0"?>
 
  <?xml version="1.0"?>
Line 70: Line 72:
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <target name="test">
 
   <target name="test">
     <taskdef name="resin-unstage" classname="com.caucho.ant.ResinUnstage">
+
     <taskdef name="resin-copy-tag" classname="com.caucho.ant.ResinCopyTag">
 
       <classpath>
 
       <classpath>
 
         <fileset dir="${resin.home}">
 
         <fileset dir="${resin.home}">
Line 79: Line 81:
 
     </taskdef>
 
     </taskdef>
 
   
 
   
     <resin-unstage server="localhost"
+
     <resin-copy-tag server="localhost"
                    port="8080"
+
                    port="8080"
                    user="admin"
+
                    user="admin"
                    password="myadminpass"
+
                    password="myadminpass"
                    contextRoot="cloudapp"/>
+
                    stage="default"
 +
                    contextRoot="cloudapp"
 +
                    sourceStage="preview"/>
 
   </target>
 
   </target>
 
  </project>
 
  </project>
  
== resin-list-versions ==
+
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.
To list all the versions of an application and show which version is the current (head) version, use the "resin-list-versions" task:
+
 
 +
== resin-delete-tag ==
 +
To delete a tag, use the "resin-delete-tag" task:
  
 
  <?xml version="1.0"?>
 
  <?xml version="1.0"?>
Line 94: Line 100:
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <target name="test">
 
   <target name="test">
     <taskdef name="resin-list-versions" classname="com.caucho.ant.ResinListVersions">
+
     <taskdef name="resin-delete-tag" classname="com.caucho.ant.ResinDeleteTag">
 
       <classpath>
 
       <classpath>
 
         <fileset dir="${resin.home}">
 
         <fileset dir="${resin.home}">
Line 103: Line 109:
 
     </taskdef>
 
     </taskdef>
 
   
 
   
     <resin-list-versions server="localhost"
+
     <resin-delete-tag server="localhost"
                          port="8080"
+
                      port="8080"
                          user="admin"
+
                      user="admin"
                          password="myadminpass"
+
                      password="myadminpass"
                          contextRoot="cloudapp"/>
+
                      stage="preview"
 +
                      contextRoot="cloudapp"/>
 
   </target>
 
   </target>
 
  </project>
 
  </project>
  
Sample output:
+
== resin-query-tags ==
[resin-list-versions] default/wars/default/cloudapp -> default/wars/default/cloudapp-2.0
+
[resin-list-versions] default/wars/default/cloudapp-1.0
+
[resin-list-versions] default/wars/default/cloudapp-2.0 (HEAD)
+
 
+
== resin-set-head-version ==
+
To change the active version of a versioned webapp, use the "resin-set-head-version" task:
+
  
 
  <?xml version="1.0"?>
 
  <?xml version="1.0"?>
Line 123: Line 124:
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <property name="resin.home" value="/usr/share/resin"/>
 
   <target name="test">
 
   <target name="test">
     <taskdef name="resin-set-head-version" classname="com.caucho.ant.ResinSetHeadVersion">
+
     <taskdef name="resin-query-tags" classname="com.caucho.ant.ResinQueryTags">
 
       <classpath>
 
       <classpath>
 
         <fileset dir="${resin.home}">
 
         <fileset dir="${resin.home}">
Line 132: Line 133:
 
     </taskdef>
 
     </taskdef>
 
   
 
   
     <resin-set-head-version server="localhost"
+
     <resin-query-tags server="localhost"
                            port="8080"
+
                      port="8080"
                            user="admin"
+
                      user="admin"
                            password="myadminpass"
+
                      password="myadminpass"
                            contextRoot="cloudapp"
+
                      contextRoot="cloudapp"/>
                            version="1.0"/>
+
 
   </target>
 
   </target>
 
  </project>
 
  </project>

Revision as of 18:39, 22 September 2009

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