geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heinie Barnard" <heiniebarn...@workmail.co.za>
Subject Re: Need some help with the Ant Tasks
Date Thu, 06 Apr 2006 20:47:24 GMT
Thanks Dain

Great Idea !, for those of you not in irc (Dain and I have
already discussed in irc).

I am almost finish with the changes. I ran in the following
problem:
Coloured version at http://rifers.org/paste/show/468

This file is in the jar file under
org/apache/geronimo/ant/deployment/ant-geronimo.xml

<?xml version="1.0"?>

<!--
/**
 *
 * Copyright 2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the
"License");
 *  you may not use this file except in compliance with the
License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in
writing, software
 *  distributed under the License is distributed on an "AS
IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
 *  See the License for the specific language governing
permissions and
 *  limitations under the License.
 */
 -->

<antlib>

  <taskdef name="startServer"    
classname="org.apache.geronimo.ant.deployment.StartRemoteServer"
/>
  <taskdef name="stopServer"     
classname="org.apache.geronimo.ant.deployment.StopRemoteServer"
 />
    <taskdef name="waitForStarted" 
classname="org.apache.geronimo.ant.deployment.WaitForStarted"
   />
    <taskdef name="deployModule"   
classname="org.apache.geronimo.ant.deployment.DistributeModule"
 />
    <taskdef name="undeployModule" 
classname="org.apache.geronimo.ant.deployment.UndeployModule"
   />
    <taskdef name="startModule"    
classname="org.apache.geronimo.ant.deployment.StartModule"
      />
    <taskdef name="stopModule"     
classname="org.apache.geronimo.ant.deployment.StopModule"
       />

</antlib>


This is my build.xml file

<?xml version="1.0"?>

<!--
/**
 *
 * Copyright 2004 The Apache Software Foundation
 *
 *  Licensed under the Apache License, Version 2.0 (the
"License");
 *  you may not use this file except in compliance with the
License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in
writing, software
 *  distributed under the License is distributed on an "AS
IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.
 *  See the License for the specific language governing
permissions and
 *  limitations under the License.
 */
 -->

<project name="GeronimoTaskExample" default="help"
basedir="."
xmlns:g="antlib:org.apache.geronimo.ant.deployment">

  <!-- CONFIG SETUP -->
 <property name="target"
     value="C:/geronimo-jetty/geronimo-1.0" />
 <property name="server"     
value="jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
/>

 <property name="module"     
value="${maven.repo.local}/myproject/jars/myapplication-1.0-SNAPSHOT.jar"
/>
 <property name="moduleId"
   value="org/myproject/MyConfigurationName" />

 <property name="username"    value="system" />
 <property name="password"    value="manager" />

    <typedef
file="org/apache/geronimo/ant/deployment/ant-geronimo.xml"
uri="g:org.apache.geronimo.ant.deployment">
   <classpath>
    <pathelement location="lib/GeronimoAntTask.jar" />
    <fileset dir="${target}/lib">
         <include name="*.jar"/>
          </fileset>
   <fileset dir="${target}/repository/geronimo/jars">
         <include name="*.jar"/>
          </fileset>
   </classpath>
  </typedef>

    <target name="help">
      <echo message="Options:"/>
    <echo message="ant start - Start the configured
Geronimo Server"/>
      <echo message="ant stop - Stop the configured
Geronimo Server"/>
  <echo message=""/>
  <echo message="ant deploy - Start the configured Geronimo
Server"/>
     <echo message="ant undeploy - Stop the configured
Geronimo Server"/>
  <echo message=""/>
  <echo message="ant startModule - Start the configured
Module"/>
     <echo message="ant stopModule - Stop the configured
Module"/>
    </target>

 <target name="start">
   <g:startServer geronimoTarget="${target}">
   </g:startServer>
   <echo message="Server started"/>
 </target>

  <target name="stop">
   <g:stopServer uri="${server}" username="${username}"
password="${password}">
   </g:stopServer>
  </target>

 <target name="startModule">
   <g:startModule uri="${server}" username="${username}"
password="${password}" id="${moduleId}">
   </g:startModule>
  </target>

  <target name="stopModule">
   <g:stopModule  uri="${server}" username="${username}"
password="${password}" id="${moduleId}">
   </g:stopModule>
  </target>

  <!-- If deploying a new Module make sure it stops the
previous one -->
    <target name="deploy" depends="stopModule">
   <g:deploy uri="${server}" username="${username}"
password="${password}"
home="${basedir}" module="${module}">
   </g:deploy>
    </target>

  <!-- If deploying a new Module make sure it stops the
previous one -->
 <target name="undeploy" depends="stopModule">
   <g:undeploy uri="${server}" username="${username}"
password="${password}" id="${moduleId}">
   </g:undeploy>
 </target>

</project>


For some odd "uri" reason ant is looking for the
ant-geronimo.xml on my
local file system and not in the jar.

I get the following from ant

Buildfile: build.xml
  [typedef] File C:\Documents and Settings\Heinie
Barnard\workspace\GeronimoAntT
asks\org\apache\geronimo\ant\deployment\ant-geronimo.xml
does not exist


Regards
Heinie Barnard
Kaybee IT Solutions
Orbis non sufficit



> Can we wrap the tasks up into an AntLib so it is easier
for our users
> to declare and use the tasks?   The maven team has
wrapped their
> artifact management code into an ant lib so ant users can
use the
> maven repo.
>
> Here is some info on ant libs:
>    http://ant.apache.org/manual/CoreTypes/antlib.html
>
> Here is the docs on how ant users use the maven artifact
management
> ant tasks:
>    http://maven.apache.org/ant-tasks.html
>
> -dain
>
>
> On Apr 5, 2006, at 3:05 PM, Heinie Barnard wrote:
>
>> Here's the build.xml file. I tried to colour code it,
but
>> it was removed.
>>
>> <?xml version="1.0"?>
>>
>> <!--
>> /**
>>  *
>>  * Copyright 2004 The Apache Software Foundation
>>  *
>>  *  Licensed under the Apache License, Version 2.0 (the
>> "License");
>>  *  you may not use this file except in compliance with
the
>> License.
>>  *  You may obtain a copy of the License at
>>  *
>>  *     http://www.apache.org/licenses/LICENSE-2.0
>>  *
>>  *  Unless required by applicable law or agreed to in
>> writing, software
>>  *  distributed under the License is distributed on an
"AS
>> IS" BASIS,
>>  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
>> express or implied.
>>  *  See the License for the specific language governing
>> permissions and
>>  *  limitations under the License.
>>  */
>>  -->
>>
>>
>>  <project name="GeronimoTaskExample" default="help"
>> basedir=".">
>>
>>         <!-- CLASSPATH SETUP -->
>>         <property name="lib.dir" location="lib"/>
>>         <property name="gironimo.lib.dir"
>> location="C:/geronimo-1.0/lib"/>
>>         <property name="gironimo.lib.dir2"
>> location="C:/geronimo-1.0/repository/geronimo/jars"/>
>>
>>         <path id="ant.lib.path">
>>             <fileset dir="${lib.dir}">
>>                       <include name="*.jar"/>
>>             </fileset>
>>             <fileset dir="${gironimo.lib.dir}">
>>                       <include name="*.jar"/>
>>             </fileset>
>>             <fileset dir="${gironimo.lib.dir2}">
>>                       <include name="*.jar"/>
>>             </fileset>
>>         </path>
>>
>>         <!-- CONFIG SETUP -->
>>         <property name="target"
>>      value="C:/geronimo-jetty/geronimo-1.0" />
>>         <property name="server"
>>
     value="jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector"
>> />
>>
>>         <property name="module"
>>
     value="${maven.repo.local}/myproject/jars/myapplication-1.0-
>> SNAPSHOT.jar"
>> />
>>         <property name="moduleId"
>>    value="org/myproject/MyConfigurationName" />
>>
>>         <property name="username"    value="system" />
>>         <property name="password"    value="manager" />
>>
>>         <!-- TASKS -->
>>     <taskdef name="startServer"
>>
>>
classname="org.apache.geronimo.deployment.ant.StartRemoteServer"
>>    classpathref="ant.lib.path"/>
>>         <taskdef name="stopServer"
>>
>>
classname="org.apache.geronimo.deployment.ant.StopRemoteServer"
>>     classpathref="ant.lib.path"/>
>>            <taskdef name="waitForStarted"
>>
    classname="org.apache.geronimo.deployment.ant.WaitForStarted"
>>       classpathref="ant.lib.path"/>
>>     <taskdef name="deployModule"
>>
      classname="org.apache.geronimo.deployment.ant.DistributeModule"
>>     classpathref="ant.lib.path"/>
>>     <taskdef name="undeployModule"
>>
    classname="org.apache.geronimo.deployment.ant.UndeployModule"
>>       classpathref="ant.lib.path"/>
>>     <taskdef name="startModule"
>>
       classname="org.apache.geronimo.deployment.ant.StartModule"
>>          classpathref="ant.lib.path"/>
>>     <taskdef name="stopModule"
>>
        classname="org.apache.geronimo.deployment.ant.StopModule"
>>           classpathref="ant.lib.path"/>
>>
>>
>>     <!-- TARGETS -->
>>
>>   <target name="help">
>>              <echo message="Options:"/>
>>                   <echo message="ant start - Start the
configured
>> Geronimo Server"/>
>>              <echo message="ant stop - Stop the
configured
>> Geronimo Server"/>
>>                 <echo message=""/>
>>                 <echo message="ant deploy - Start the
configured Geronimo
>> Server"/>
>>                    <echo message="ant undeploy - Stop
the configured
>> Geronimo Server"/>
>>                 <echo message=""/>
>>                 <echo message="ant startModule - Start
the configured
>> Module"/>
>>                    <echo message="ant stopModule - Stop
the configured
>> Module"/>
>>   </target>
>>
>>   <target name="start">
>>           <startServer
>> geronimoTarget="C:/geronimo-jetty/geronimo-1.0">
>>           </startServer>
>> <!--  <waitForStarted uri="${server}"  username="system"
>> password="${password}"/> Not working, not sure why ? -->
>>           <echo message="Geronimo Server Started"/>
>>   </target>
>>
>>   <target name="stop">
>>         <stopServer uri="${server}"
username="${username}"
>> password="${password}">
>>         </stopServer>
>>           <echo message="Geronimo Server Stopped"/>
>>   </target>
>>
>>   <target name="stopModule">
>>         <stopModule uri="${server}"
username="${username}"
>> password="${password}" id="${moduleId}">
>>         </stopModule>
>>   </target>
>>
>>   <target name="startModule">
>>         <startModule uri="${server}"
username="${username}"
>> password="${password}" id="${moduleId}">
>>         </startModule>
>>   </target>
>>
>>   <!- If deploying a new Module make sure it stops the
>> previous one ->
>>   <target name="deploy" depends="stopModule">
>>         <deployModule uri="${server}"
username="${username}"
>> password="${password}" home="${basedir}"
>> module="${module}">
>>         </deployModule>
>>   </target>
>>
>>   <!- If deploying a new Module make sure it stops the
>> previous one ->
>>   <target name="undeploy" depends="stopModule">
>>         <undeployModule uri="${server}"
username="${username}"
>> password="${password}" id="${moduleId}">
>>         </undeployModule>
>>   </target>
>>
>> </project>
>>
>>
>>>        Good evening everybody   We need some help with
>> the Ant Plugin
>>> Tasks. We  need some people to test the tasks.   The
>> source code
>>> can be obtained at :
>>> http://issues.apache.org/jira/browse/GERONIMO-1792
>>   Prasad Kashyap
>>> and I have decided that we need to  change the
following:
>>   1)
>>> Package structure:   2) Refactor StartRemoteServer /
>>> StopRemoteServer to StartServer and StopServer   3)
>> Change the ant
>>> build file to look like  the build at the bottom
>>   Regards Heinie
>>> Barnard Kaybee IT Solutions Orbis non sufficit
>>
>>>
>>
>>
>>>
>>
>>
>>>
>>
>>
>>>
>>
>>
>>>
>>
>>
>>>
>>
>>
>>>
>>
>>
>>>
>>
>>
>>>
>>>
>>
___________________________________________________________________
>>>  For super low premiums, click here
>> http://www.webmail.co.za/dd.pwm
>>>    http://www.webmail.co.za the South African FREE
email
>> service
>>
___________________________________________________________________
>> For super low premiums, click here
http://www.webmail.co.za/dd.pwm
>>
>> http://www.webmail.co.za the South African FREE email
service
>
>
>
___________________________________________________________________
For super low premiums, click here http://www.webmail.co.za/dd.pwm

http://www.webmail.co.za the South African FREE email service

Mime
View raw message