maven 文件上传到远程服务器目录

目的:实现本地代码,或者程序包,或者单个配置文件,或者多个上传部署到服务器对应的目录中去。

问题1:用maven什么插件可以实现?

wagon-maven-plugin

该插件的maven依赖为:


    org.codehaus.mojo
    wagon-maven-plugin
    1.0

插件的文档地址为:
http://www.mojohaus.org/wagon-maven-plugin/

主要提供如下几个goal

wagon:upload-single uploads the specified file to a remote location.
wagon:upload uploads the specified set of files to a remote location.
wagon:download-single downloads the specified file from a remote location.
wagon:download downloads the specified set of files from a remote location.
wagon:list lists the content of a specified location in a remote repository.
wagon:copy copies a set of files under a Wagon repository to another.
wagon:merge-maven-repos merges , including metadata, a Maven repository to another.
wagon:sshexec Executes a set of commands at remote SSH host.

下面给出我的POM.xml



    4.0.0
    com.hdkg
    upload
    0.0.1
    
        
            org.codehaus.mojo
            wagon-maven-plugin
            1.0
        
    

    upload
    
        
            org.apache.maven.wagon
            wagon-ssh
            2.10
        
    
    
        
            org.codehaus.mojo
            wagon-maven-plugin
            1.0
            
                hdkg
                


                target/upload.jar
                

                

                
              /home/hdkg/ATC/temp
                

                scp://[email protected]









                
                true
            
        
    

我的pom文件名字是 upload.xml ,没有用pom.xml ,是因为有pom.xml了,这个upload.xml是单独为了上传文件用的

问题2:那么怎么单独执行这个upload.xml呢?

mvn wagon:upload-single -f upload.xml  这个是上传单独文件。例如jar包这样一类的

mvn wagon:upload -f upload.xml 这个是上传多文件,可以整个目录

官方示例:

http://www.mojohaus.org/wagon-maven-plugin/usage.html

 

问题3 :那么如果我想一次执行多个pom.xml文件该怎么办?

 

 

 

你可能感兴趣的:(Java编程,技术文档,Maven)