Ant + tag <ftp>

1 resposta
P

Olá pessoal , gostaria de saber uma coisa..

estou tentado utilizar as tag <ftp> do ant para realizar um ftp do arquivo jar gerado para o meu servidor...
ele esta dando o seguinte erro na execução do meu script ant :

remote.deploy.jboss321: [ftp] BUILD FAILED: file:D:/Programas/eclipse/workspace/SigeclimTeste/SigeclimEJB/META-INF/build.xml:66: Could not create task or type of type: ftp.

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

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'ftp'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and optional.jar is absent
Fix: look for optional.jar in ANT_HOME/lib, download if needed
- The task was not built into optional.jar as dependent
libraries were not found at build time.
Fix: look in the JAR to verify, then rebuild with the needed
libraries, or download a release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using <taskdef>.

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath

Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.

Tudo que ele falou ai eu ja conferi..e nao mudou muita coisa não..

esta aqui meu script ant com a tag...

&lt;!-- Remote Deploy for JBOSS 3.2.1 --&gt;
    &lt;target name=&quot;remote.deploy.jboss321&quot; depends=&quot;init,Deploy&quot;&gt;
   	   &lt;ftp 
   	         server=&quot;$&#123;ftp.host_master&#125;&quot; 
   	         port=&quot;$&#123;ftp.host_port&#125;&quot;
   	         remotedir=&quot;/home/felipe&quot;
   	         password=&quot;felipe&quot;
   	         depends=&quot;yes&quot;
   	         binary=&quot;yes&quot;&gt;
   	         
   	         &lt;fileset dir=&quot;$&#123;src.dir&#125;&quot;&gt;
   	            &lt;include name=&quot;*.jar&quot; /&gt;
   	         &lt;/fileset&gt;
   	   &lt;/ftp&gt;  	         
   &lt;/target&gt;

aqui eu no caso eu nem estou tentando pegar o jar gerado dentro da asta do meu ejb Module..e sim um jar qualquer dentro de um diretorio....mas mesmo assim deveria funcionar....

alguem ja usou essa tag?
qual foi minha caca???

Valeu.

1 Resposta

Luca

Olá

Não sei se a esta altura já resolveu sua dúvida mas só vi hoje sua questão e respondo pois pode ser que ajude outros.

Seu problema estava aqui:

The task is an Ant optional task and optional.jar is absent
Fix: look for optional.jar in ANT_HOME/lib, download if needed

  • The task was not built into optional.jar as dependent
    libraries were not found at build time.

Ou seja, falta o jar com a task ftp
  1. A task FTP não vem com ant, é preciso baixar netcomponents.jar de http://www.savarese.org/oro/downloads/index.html#NetComponents e colocar em ANT_HOME/lib. Ver: http://ant.apache.org/manual/install.html#librarydependencies

  2. O uso de ftp deve estar de acordo com: http://ant.apache.org/manual/OptionalTasks/ftp.html

Os passos 1 e 2 resolvem seu problema. Como brinde incluo um exemplo que funciona para transferir um arquivo .tar:

&lt;?xml version="1.0" encoding="ISO-8859-1" ?&gt;
&lt;!--  UTF-8 não aceita acentos                            --&gt;

&lt;!--  =================================================   --&gt; 
&lt;!--  build.xml para instalar projeto xpto     --&gt; 
&lt;!--  10/03/2002 - &#40;-compile,etc.;+war,ear,ftp&#41;           --&gt; 
&lt;!--  18/03/2002 - EARExpander                            --&gt;
&lt;!--  19/04/2002 - Modificações diversas                  --&gt;
&lt;!--  =================================================   --&gt; 


&lt;project name="xpto" default="init" basedir="."&gt;

  &lt;description&gt;
    build.xml para xpto 
    seguintes propriedades &#40;valores abaixo são exemplos&#41;&#58;
       server=10.8.33.39
      userid=tomcat
      password=tomcat
 
  &lt;/description&gt;


  &lt;!--  =================================================   --&gt; 
  &lt;!--  init                                             --&gt; 
  &lt;!--  Inicialização das variáveis                         --&gt; 
  &lt;!--  Se existe fileprop.properties,        --&gt;
  &lt;!--  pega as properties do arquivo &#40;NÃO INCLUÍDO NESTE EXEMPLO&#41; --&gt; 
  &lt;!--  Se não existe,  uma a uma                         --&gt;
  &lt;!--  =================================================   --&gt; 
  &lt;target name="init"&gt;
    &lt;record name="antlog.txt" loglevel="verbose" /&gt;
    &lt;tstamp/&gt;

&lt;echo&gt;------------------------------------------------------------&lt;/echo&gt;
    &lt;echo&gt;&lt;/echo&gt;
    &lt;echo&gt;Build of $&#123;ant.project.name&#125; started at $&#123;TSTAMP&#125; on $&#123;TODAY&#125;&lt;/echo&gt;
  &lt;/target&gt;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

  &lt;!--  =================================================   --&gt; 
  &lt;!--  initWin                                             --&gt; 
  &lt;!--  Inicialização das variáveis                         --&gt; 
  &lt;!--  =================================================   --&gt; 
  &lt;target name="initWin" depends="init"&gt;

    &lt;echo&gt;Executando initWin&lt;/echo&gt;
    &lt;property name="server" value="10.0.2.220" /&gt;
    &lt;property name="userid" value="tomcat" /&gt;
    &lt;property name="password" value="tomcat" /&gt;
    &lt;property name="ftppattern" value="xpto.tar" /&gt;

  &lt;/target&gt;

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

&lt;!--  =================================================   --&gt; 
  &lt;!--  ftptar                                              --&gt; 
  &lt;!--  ftp xpto.tar para /home/$&#123;userid&#125; no servidor   --&gt; 
  &lt;!--  =================================================   --&gt;
  &lt;target name="existexpto"&gt;
    &lt;available file="xpto.tar" type="file" property="xpto.present"/&gt;
  &lt;/target&gt;

  &lt;target name="ftptar" depends="initWin,existexpto" if="xpto.present"&gt;

    &lt;echo message="Executando ftptar"/&gt;
    &lt;ftp server="$&#123;server&#125;"
      remotedir="/home/$&#123;userid&#125;/montagem"
         userid="$&#123;userid&#125;"
       password="$&#123;password&#125;"
         binary="yes"
        verbose="yes"&gt;

      &lt;fileset dir="."&gt;
        &lt;include name="$&#123;ftppattern&#125;"/&gt;
      &lt;/fileset&gt;
      
    &lt;/ftp&gt;

  &lt;/target&gt;

[]s
Luca

Criado 3 de dezembro de 2003
Ultima resposta 15 de dez. de 2003
Respostas 1
Participantes 2