Upload file via Ant FTP task in Maven

前端 未结 3 1453
时光说笑
时光说笑 2021-01-12 16:10

I\'m trying to upload a file using an Ant task. If I use Ant directly the file is uploaded, but if I call the ant task via Maven (using the maven-antrun-plugin)

3条回答
  •  Happy的楠姐
    2021-01-12 16:56

    ant-commons-net.jar is clearly available to Ant

    Yes, but Maven and the maven-antrun-plugin is not using your local Ant install.

    Is the Ant classpath defined separately for maven-antrun-plugin, or am I missing something?

    The way to use Ant Tasks not included in Ant's default jar is documented in Using tasks not included in Ant's default jar (which should definitely help):

    To use Ant tasks not included in the Ant jar, like Ant optional or custom tasks you need to add the dependencies needed for the task to run to the plugin classpath and use the maven.plugin.classpath reference if needed.

    
      4.0.0
      my-test-app
      my-test-group
      1.0-SNAPSHOT
    
      
        
           
             org.apache.maven.plugins
             maven-antrun-plugin
             1.6
             
               
                 ftp
                 deploy
                 
                   
    
                     
                       
                         
                       
                     
    
                     
                     
    
                   
                 
                 
                   run
                 
               
             
             
               
                 commons-net
                 commons-net
                 1.4.1
               
               
                 ant
                 ant-commons-net
                 1.6.5
               
               
                 ant
                 ant-nodeps
                 1.6.5
               
             
           
        
      
    
    

提交回复
热议问题