Ant

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
(added ant-deploy)
(added new deploy tasks)
Line 1: Line 1:
Resin 3.1.5 includes a resin-ant.jar in ${resin.home}/plugins/resin-ant.jar with several useful task:
 
 
 
== resin-jspc ==
 
== 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=".">
 
  <project name="test" default="test" basedir=".">
Line 21: Line 21:
 
   
 
   
 
   </project>
 
   </project>
 +
 +
== resin-deploy ==
  
 
Resin 4 will include an Ant deploy client that can deploy applications to a Resin cloud.
 
Resin 4 will include an Ant deploy client that can deploy applications to a Resin cloud.
  
== resin-deploy ==
 
 
  <?xml version="1.0"?>
 
  <?xml version="1.0"?>
 
  <project name="test" default="test" basedir=".">
 
  <project name="test" default="test" basedir=".">
 
   <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" classname="com.caucho.ant.ResinDeploy">
+
     <taskdef name="resin-deploy-war" classname="com.caucho.ant.ResinDeployWar">
 +
      <classpath>
 +
        <fileset dir="${resin.home}">
 +
          <include name="lib/*.jar"/>
 +
          <include name="plugins/resin-ant.jar"/>
 +
        </fileset>
 +
      </classpath>
 +
    </taskdef>
 +
 +
    <resin-deploy-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-deploy-war server="localhost"
 +
                      port="8080"
 +
                      user="admin"
 +
                      password="myadminpass"
 +
                      warFile="cloudapp.war"
 +
                      version="1.0"/>
 +
 
 +
To stage an application before deploying it to production, set the staging attribute:
 +
    <resin-deploy-war server="localhost"
 +
                      port="8080"
 +
                      user="admin"
 +
                      password="myadminpass"
 +
                      warFile="cloudapp.war"
 +
                      staging="true"/>
 +
 
 +
== resin-unstage ==
 +
To move an application from a staged state to a production state, use the "resin-unstage" 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-unstage" classname="com.caucho.ant.ResinUnstage">
 +
      <classpath>
 +
        <fileset dir="${resin.home}">
 +
          <include name="lib/*.jar"/>
 +
          <include name="plugins/resin-ant.jar"/>
 +
        </fileset>
 +
      </classpath>
 +
    </taskdef>
 +
 +
    <resin-unstage server="localhost"
 +
                    port="8080"
 +
                    user="admin"
 +
                    password="myadminpass"
 +
                    contextRoot="cloudapp"/>
 +
  </target>
 +
</project>
 +
 
 +
== resin-list-versions ==
 +
To list all the versions of an application and show which version is the current (head) version, use the "resin-list-versions" 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-list-versions" classname="com.caucho.ant.ResinListVersions">
 +
      <classpath>
 +
        <fileset dir="${resin.home}">
 +
          <include name="lib/*.jar"/>
 +
          <include name="plugins/resin-ant.jar"/>
 +
        </fileset>
 +
      </classpath>
 +
    </taskdef>
 +
 +
    <resin-list-versions server="localhost"
 +
                          port="8080"
 +
                          user="admin"
 +
                          password="myadminpass"
 +
                          contextRoot="cloudapp"/>
 +
  </target>
 +
</project>
 +
 
 +
Sample output:
 +
[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"?>
 +
<project name="test" default="test" basedir=".">
 +
  <property name="resin.home" value="/usr/share/resin"/>
 +
  <target name="test">
 +
    <taskdef name="resin-set-head-version" classname="com.caucho.ant.ResinSetHeadVersion">
 
       <classpath>
 
       <classpath>
 
         <fileset dir="${resin.home}">
 
         <fileset dir="${resin.home}">
Line 38: Line 132:
 
     </taskdef>
 
     </taskdef>
 
   
 
   
     <resin-deploy server="localhost"
+
     <resin-set-head-version server="localhost"
                  port="8080"
+
                            port="8080"
                  user="admin"
+
                            user="admin"
                  password="myadminpass"
+
                            password="myadminpass"
                  warFile="cloudapp.war"/>
+
                            contextRoot="cloudapp"
 +
                            version="1.0"/>
 
   </target>
 
   </target>
 
  </project>
 
  </project>

Revision as of 22:21, 20 August 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>

resin-deploy

Resin 4 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-deploy-war" classname="com.caucho.ant.ResinDeployWar">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-deploy-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-deploy-war server="localhost"
                      port="8080"
                      user="admin"
                      password="myadminpass"
                      warFile="cloudapp.war"
                      version="1.0"/>

To stage an application before deploying it to production, set the staging attribute:

    <resin-deploy-war server="localhost"
                      port="8080"
                      user="admin"
                      password="myadminpass"
                      warFile="cloudapp.war"
                      staging="true"/>

resin-unstage

To move an application from a staged state to a production state, use the "resin-unstage" 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-unstage" classname="com.caucho.ant.ResinUnstage">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-unstage server="localhost"
                   port="8080"
                   user="admin"
                   password="myadminpass"
                   contextRoot="cloudapp"/>
  </target>
</project>

resin-list-versions

To list all the versions of an application and show which version is the current (head) version, use the "resin-list-versions" 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-list-versions" classname="com.caucho.ant.ResinListVersions">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-list-versions server="localhost"
                         port="8080"
                         user="admin"
                         password="myadminpass"
                         contextRoot="cloudapp"/>
  </target>
</project>

Sample output:

[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"?>
<project name="test" default="test" basedir=".">
  <property name="resin.home" value="/usr/share/resin"/>
  <target name="test">
    <taskdef name="resin-set-head-version" classname="com.caucho.ant.ResinSetHeadVersion">
      <classpath>
        <fileset dir="${resin.home}">
          <include name="lib/*.jar"/>
          <include name="plugins/resin-ant.jar"/>
        </fileset>
      </classpath>
    </taskdef>

    <resin-set-head-version server="localhost"
                            port="8080"
                            user="admin"
                            password="myadminpass"
                            contextRoot="cloudapp"
                            version="1.0"/>
  </target>
</project>
Personal tools