maven deployment with ftp uploading: I want to upload just the war file but is uploading more files

我的未来我决定 提交于 2019-12-10 10:12:37

问题


I am following instructions exactly as specified here:

http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ftp.html

(The only difference is that I'm using version 2.4 of wagon-ftp).

and then execute

mvn deploy

I just want to upload a single war file, however it uploads several other files, with pom, md5, sha1 extensions and buries them under one of my source directories.

I've been trying to look for the appropriate configuration to modify this behaviour with no luck yet.


回答1:


wagon-plugins are for deploying artifacts to repositories, repositories need all those other files to function. If you are trying to ftp your .war file to a server for deployment, then use the correct plugin for your server, not the wagon-plugin.

The documentation for that plug starts off with

In order to deploy artifacts using FTP ...

mvn deploy is for deploying artifacts to a repository, thus all the other files that are needed for the repository to function are uploaded as well.




回答2:


Use Ant and it's FTP task in order to upload generated war file.

With antrun plugin you can execute your ant script like that:

 <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-antrun-plugin</artifactId>
   <version>1.7</version>
   <configuration>
     <target>
        <property name="file_name" value="${project.build.finalName}.war" />
        <ant antfile="${basedir}/build.xml">
           <target name="war upload" />
        </ant>
     </target>
   </configuration>
 </plugin>

Use property in order to define some property like file name/path to ant script. All maven's properties are accessible in ant script too.



来源:https://stackoverflow.com/questions/15884708/maven-deployment-with-ftp-uploading-i-want-to-upload-just-the-war-file-but-is-u

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!