Solved

Ant using FTP action to remove a directory

Posted on 2004-08-04
9
2,298 Views
Last Modified: 2010-05-18
I'm having a problem removing a directory with the FTP acion in Ant.  It says that rmdir is not a legal value for the ftp attribute.  Here is some of the code.  The "del" and "mkdir" actions work.

Any help resolving this is appreciated!


************ CODE SNIPPET *********************
<target name="FTPFiles" depends="init">

      <ftp action="del"
            server="${WASServer.DEV}"
            port="21"
            remotedir="/local/WebSphere/deploy/${property.app.name}/common"
            userid="wsadmin"
            password="${wsadmin.password}">
      <fileset>
            <include name="**"/>
      </fileset>
      </ftp>

      <ftp action="mkdir"
       server="${WASServer.DEV}"
       userid="wsadmin"
       password="${wsadmin.password}"
       remotedir="/local/WebSphere/deploy/${property.app.name}/testdir">
      </ftp>

      <ftp action="rmdir"
            server="${WASServer.DEV}"
            port="21"
            remotedir="/local/WebSphere/deploy/${property.app.name}/common" >
            userid="wsadmin"
            password="${wsadmin.password}"
      <fileset>
            <include name="**"/>
      </fileset>
      </ftp>
************ END CODE SNIPPET *********************

********** LOG FILE *********************
FTPFileTask:
     [echo] Build ALL for FTPBuildFiles at 05:01:53
     [echo] JAVA Version 1.3
     [echo] ScriptEngine

init:

FTPFiles:
      [ftp] deleting files
      [ftp] 5 files deleted
       [if] Error in class net.sf.antcontrib.logic.IfTask

BUILD FAILED
file:C:/ccBuild/ANT_vob/Ant/Build/FTPSECommonFiles.xml:104: rmdir is not a legal value for this attribute

Total time: 1 second
******************* END LOG FILE *********

0
Comment
Question by:lphillips120898
  • 5
  • 3
9 Comments
 
LVL 92

Expert Comment

by:objects
ID: 11721879
rmdir is not a valid action.
I don't think the ant task supports removing directories, but try using the del action.
0
 
LVL 7

Expert Comment

by:grim_toaster
ID: 11723614
-->rmdir is not a valid action.
Unless it didn't exist in a previous version of ant (which version are you using?), the link below for the 1.6.2 manual shows that it is valid.
http://ant.apache.org/manual/OptionalTasks/ftp.html

However, you rmdir tag appears wrong.  You hava the closing ">" halfway through, is this just a copy/paste error, as you should have got a parse exception.
0
 
LVL 92

Expert Comment

by:objects
ID: 11723804
> Unless it didn't exist in a previous version of ant

Appears that is the case, I should upgrade :)

Perhaps lphillips also has an old version.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:lphillips120898
ID: 11725677
I have version 1.5.  I'm going to try and see if I can find out if this is a new feature with 1.6 before I upgrade.

objects - I tried using the del action, but couldn't get it to delete directories.  If you have any insight on what the syntax might be please feel free to share!

grim_toaster - you're right, I did have the tag in the wrong place.  I corrected it, but still get the same results.

Thanks,

Lisa
0
 

Author Comment

by:lphillips120898
ID: 11727186
Okay, I have confirmed that "rmdir" was not in ant version 1.5, so I upgraded to 1.6.2.  Now I have another issue.  Here is the error:

*********** ERROR ***********
 [taskdef] Could not load definitions from resource net/sf/antcontrib/antcontrib.properties. It could not be found.

BUILD FAILED
C:\ccBuild\ANT_vob\Ant\Build\FTPBuildFiles.xml:54: Could not create task or type of type: if.

Ant could not find the task or a class this task relies upon.
************ END ERROR **********************

I'm guessing this is because this task is dependent on optional/additional libraries.  In the past I was using NetComponents-1.3.8a, but apparently this has been replaced by commons-net-1.2.2.  Look at the bottom of this page to see where I get this assumption:  http://jakarta.apache.org/commons/net/

I tried using the NetComponents-1.3.8a with the new version of ant, but figured it didn't work with it since I got that error.

So I assume that I can download this component and I will be okay.  Newer version of Ant and newer version of net component.  The problem is I can't find where to download it.  If you look on the components page (http://jakarta.apache.org/commons/components.html) it list all the components.  If you click on the individual ones you they have links to download the component, but the net component doesn't have a download link.

Can anyone shed some light on where I might get this - or better yet... is this what I need and if not please point me to what I do need to get FTP in ant working.

Thanks,

Lisa

0
 

Author Comment

by:lphillips120898
ID: 11727450
Never mind... I figured it out.  I didn't have it on the path.
0
 

Author Comment

by:lphillips120898
ID: 11727769
the rmdir is now working.... is there a way I assign the original amount of points?  I bumped them up when I couldn't figure out how to get the ftp working again, but then I figured it out.

Let me know,

Lisa
0
 

Author Comment

by:lphillips120898
ID: 11730761
I want to keep this question open with the new point value of 250, I've run into some issues still trying to get the rmdir working, plus delete is not working the way it was before.

My first question is... in the documentation for 1.5 did not have the "rmdir" option for the ftp tag, but 1.6 does.  What I don't understand though is that you still have to download a third party package/jar for the ftp portion of ant to work.  So is it really the ant version that matters or the commons-net version that matters?

Anyway, at this point I have the following error when I try to remove or delete a directory.

***** ERROR ********
FTPFiles:
      [ftp] deleting files

BUILD FAILED
C:\ccBuild\ANT_vob\Ant\Build\FTPSECommonFiles.xml:47: The following error occurred while executing this line:
java.lang.NoClassDefFoundError: org/apache/oro/text/regex/MalformedPatternException
*****************

I found the following on Google from someone that was getting the same error message:
**
Solved. I download "jakarta-oro-[version].jar ". And its working.
**

I tried to find this jar, but I don't know what I should be putting the [version] section.  Does anyone have a clue?  I'm using  commons-net-1.2.2 for the additional component needed for using FTP in Ant.





0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 11731318
> So is it really the ant version that matters or the commons-net version that matters?

ant

> I tried to find this jar, but I don't know what I should be putting the [version] section.  Does anyone have a clue?

http://jakarta.apache.org/oro/
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Android development question 2 75
going to wrong jsp page 2 46
passing enum to a method 4 34
Regarding swagger API 1 32
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question