[英]Maven : Not able to copy resources to remote dir
我在用 :
预计将3个资源文件从我正在编译的服务器复制到要复制资源文件的服务器。预期方式:
因此,我在pom.xml中将配置文件设置为:
<profile>
<id>dev</id>
<activation/>
<properties>
<INSTALL_MACHINE_LIST>dc1uoappptl01.patamoc-us.com</INSTALL_MACHINE_LIST>
<COPY_MODE>sftp</COPY_MODE>
<FTP_USERNAME>theusr</FTP_USERNAME>
<FTP_PASSWORD>pswd</FTP_PASSWORD>
<project_lib>/online/sand/pps/apache-tomcat-9.0.8/webapps</project_lib>
</properties>
</profile>
复制资源,我用过:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<target>
<copy file="${project.build.directory}/classes/env/${current_env}_context.xml"
tofile="${project_lib}/pps/META-INF/context.xml"
overwrite="true"/>
<copy file="${project.build.directory}/classes/env/${current_env}_application.properties"
tofile="${project_lib}/pps/WEB-INF/classes/application.properties"
overwrite="true"/>
<copy file="${project.build.directory}/classes/env/${current_env}_promote_servers.properties"
tofile="${project_lib}/pps/WEB-INF/classes/promote_servers.properties"
overwrite="true"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
我的.war文件被stfp定位到正确的位置。 但是,资源文件不是。 我已经检查了目录权限是否在应该复制文件的远程目录中。 maven安装的日志文件显示资源已复制到上述目录,安装成功。
对我想念的东西有任何想法吗? 我应该为资源复制部分使用其他插件吗?
我的第一个猜测是,复制文件的生命周期阶段为时已晚(或紧随实际资源的sftp之后),但为了证明您还应该发布复制sftp的目标。
您可以尝试简单地更改
<executions>
<execution>
<phase>install</phase>
至
<executions>
<execution>
<phase>package</phase>
所以它处于早期阶段...请参阅https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.