ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Issues executing a external task. Was: How to print out a < path > structure
Date Wed, 12 Nov 2003 07:03:29 GMT
Some points I would try now:
- Use the Taskdef outside of the target.
  <project>
    <taskdef name="editproperties"
classname="com.pazoom.tools.EditPropertiesTask"/>
    ...
  </project>

- check if the right classname is used

- check whether that class is available from ant
  <available property="class.present"
classname="com.pazoom.tools.EditPropertiesTask"/>
  <echo>Class is in the classpath: ${class.present}</echo>


BTW, a Task has not to extdend org.apache.tools.ant.Task :-)
You have only to provide a  
  public void execute()
method. Then the task adapter would do the rest ... (but extending Task
it´s easier - see the tutorial [1]).



Jan


[1] http://ant.apache.org/manual-1.6beta/tutorial-writing-tasks.html
  



> -----Original Message-----
> From: Conelly, Luis (EM, DDEMESIS) [mailto:Luis.Conelly@ge.com]
> Sent: Tuesday, November 11, 2003 4:37 PM
> To: Ant Users List
> Subject: Issues executing a external task. Was: How to print 
> out a <path
> > structure
> 
> 
> 
> 	I have used ant -debug to find out what's happening. 
> The jar file is actually on the ANT_HOME/lib (as a matter of 
> fact, is part of the env.LOCALCLASSPATH environment variable 
> (at least, that's what ant reports).
> 	
> 	I removed the classname reference from the taskdef, but 
> still nothing happens... 
> 
> 	Something curious is that I can't find the task I want 
> to execute when using ant -debug. I have decompiled the class 
> using Borland JBuilder 9, and the class extends from 
> org.apache.tools.ant.Task. 
> 
> 	Hope you can help me / gimmie a clue about this issue.
> 
> 	Regards
> 
> 	-Luis
> 
> 
> 
> 
> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> Sent: Tuesday, November 11, 2003 3:49 AM
> To: user@ant.apache.org
> Subject: RE: How to print out a <path > structure
> 
> 
>     <target name="declareEditProperties" >
>         <taskdef name="editproperties" 
>                  classpath="${env.ANT_HOME}/lib/editproperties.jar"
>                  classname="com.pazoom.tools.EditPropertiesTask"/>
>     </target>
> 
> 
> Are you sure, that JAR file exists there? What means "ant -verbose"?
> BTW - if you save that jar in ANT_HOME/lib, you don´t have to use
> the classpath attribute, it´s already included by the launchers.
> 
> 
> Jan
> 
> 
> 
> > -----Original Message-----
> > From: Conelly, Luis (EM, DDEMESIS) [mailto:Luis.Conelly@ge.com]
> > Sent: Monday, November 10, 2003 6:16 PM
> > To: Ant Users List
> > Subject: RE: How to print out a <path > structure
> > 
> > 
> > Jan / All
> > 
> > 	I have checked out the reference you sent me. However I 
> > am still having certain issues (the task cannot be found)
> > 
> > 	This is a snippet of the test:
> > 
> >     <!--Build.xml-->
> >     <property environment="env"/>
> >     <property name="dist" location="dist"/>
> > 	
> >     <!--Set Classpath-->
> >     <path id="project.class.path">
> >         <pathelement path="${env.CLASSPATH}"/>
> >         <fileset dir="${lib}">
> >             <include name="**/*.jar"/>
> >             <include name="**/*.zip"/>
> >         </fileset>
> >         <fileset dir="${env.ANT_HOME}/lib">
> >             <include name="**/*.jar"/>
> >             <include name="**/*.zip"/>
> >         </fileset>
> >         <pathelement location="src"/>
> >     </path>
> >       
> >     <!-- Taskdef for editproperties task-->
> >     <target name="declareEditProperties" >
> >         <taskdef name="editproperties" 
> >                  classpath="${env.ANT_HOME}/lib/editproperties.jar"
> >                  classname="com.pazoom.tools.EditPropertiesTask"/>
> >     </target>
> > 
> >     <!--init target - Starts the tstamp task -->
> >     <target name="init" description="Initializes Time / 
> Date feature">
> >         <tstamp/>
> >         <echo message="${DSTAMP} - ${TSTAMP}"/>
> >         <property name="project.class.path.value" 
> > refid="project.class.path"/>
> >         <echo message="The classpath for this build file is:"/>
> >         <echo message="${project.class.path.value}"/>
> >     </target>
> >       
> >     <target name="editprops" depends="declareEditProperties,init">
> >         <editproperties 
> file="${dist}/lib/${DSTAMP}/edocs.properties">
> >             <editproperty name="ematrix_port" value="7001"/>   
> >             <editproperty name="server_ip" 
> > value="sjcqa01.ne.ge.com"/>   
> >             <editproperty name="server_port" value="1099"/>   
> >             <editproperty name="temp_path_checkout" 
> > value="${qa.path.checkout}"/>   
> >             <editproperty name="application.path" 
> > value="${qa.app.path}"/>   
> >         </editproperties>
> >     </target>
> >     <!--End of Build.xml-->
> > 
> >     But when I execute the 'editprops' task, I got following error:
> > 
> > -------------------------------------------------
> > Buildfile: build.xml
> > 
> > declareEditProperties:
> > 
> > BUILD FAILED
> > file:C:/Projects/GNF/eDocs/build.xml:69: taskdef class 
> > com.pazoom.tools.EditPropertiesTask cannot be found
> > 
> > Total time: 1 second
> > -------------------------------------------------
> > 
> > The jar file (editproperties.jar) which contains this task is 
> > in my %ANT_HOME%/lib directory
> > 
> > I've tried both to set the classpath either by a <path> 
> > structure and by setting the classpath in the taskdef, but 
> > nothing seems to work. 
> > 
> > Any thoughts about this?
> > 
> > Regards
> > -Luis
> > 
> > -----Original Message-----
> > From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> > Sent: Monday, November 10, 2003 1:55 AM
> > To: user@ant.apache.org
> > Subject: RE: How to print out a <path > structure
> > 
> > 
> > > 	I'd like to know which jar files are available for my 
> > > ant tasks. This is a snippet of the script
> > > 
> > >     <path id="project.class.path">
> > >         <pathelement path="${env.CLASSPATH}"/>
> > >         <fileset dir="${lib}">
> > >             <include name="**/*.jar"/>
> > >             <include name="**/*.zip"/>
> > >         </fileset>
> > >         <fileset dir="${env.ANT_HOME}/lib">
> > >             <include name="**/*.jar"/>
> > >             <include name="**/*.zip"/>
> > >         </fileset>
> > >         <pathelement location="src"/>
> > >     </path>
> > > 
> > > 	I want to know which jar & zip files I can reach within 
> > > an ant task, bcoz I want to implement a new task and I drop 
> > > the jar file in $ANT_HOME/lib, but it seems I cannot 
> > > implement a task within the jar file.
> > 
> > 
> > You can print out a path with <pathconvert> and <echo>.
> > 
> > Have you <taskdef>ed your new task?
> > Maybe the tutorial in the Manual will help you
> > http://ant.apache.org/manual-1.6beta/tutorial-writing-tasks.html
> > 
> > 
> > Jan
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message