【问题标题】:maven deployment with ftp uploading: I want to upload just the war file but is uploading more files使用 ftp 上传的 Maven 部署:我只想上传 war 文件,但正在上传更多文件
【发布时间】:2013-04-08 16:53:58
【问题描述】:

我完全按照此处指定的说明进行操作:

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

(唯一的区别是我使用的是 2.4 版的 wagon-ftp)。

然后执行

mvn 部署

我只想上传一个 war 文件,但是它上传了几个其他文件,带有 pom、md5、sha1 扩展名,并将它们埋在我的一个源目录下。

我一直在尝试寻找合适的配置来修改此行为,但还没有成功。

【问题讨论】:

    标签: maven ftp pom.xml maven-wagon-plugin


    【解决方案1】:

    使用 Ant 和 FTP task 来上传生成的战争文件。

    使用antrun plugin,您可以像这样执行您的 ant 脚本:

     <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>
    

    使用property 来定义一些属性,例如文件名/ant 脚本的路径。也可以在 ant 脚本中访问所有 maven 的属性。

    【讨论】:

    • 感谢您的回答,这就是我最终使用的原因,虽然我没有在目标中创建“ant”任务,但只是定义了“ftp”参数并创建了一个 taskdef。我不知道你为什么被否决。这是一个有效的解决方案。
    【解决方案2】:

    wagon-plugins 用于将工件部署到存储库,存储库需要所有其他文件才能运行。如果您尝试将 .war 文件 ftp 到服务器进行部署,请为您的服务器使用正确的插件,而不是 wagon-plugin。

    该插件的文档以

    开头

    为了使用 FTP 部署工件 ...

    mvn deploy 用于将工件部署到存储库,因此存储库运行所需的所有其他文件也会被上传。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-07-10
      • 2013-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-11
      • 2020-01-24
      相关资源
      最近更新 更多