Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用maven复制jar文件_Maven_Ant_Pom.xml - Fatal编程技术网

用maven复制jar文件

用maven复制jar文件,maven,ant,pom.xml,Maven,Ant,Pom.xml,我正试图将Maven 3创建的.jar复制到另一个位置。 目前,我正在使用Ant的复制任务,但Maven根本不复制文件 <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>install</phase> <configuration>

我正试图将Maven 3创建的.jar复制到另一个位置。 目前,我正在使用Ant的复制任务,但Maven根本不复制文件

<plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
    <execution>
      <phase>install</phase>
      <configuration>
        <tasks>
          <copy file="target/myfile.jar" tofile="D:/Bukkit/plugins/myfile.jar"/>
        </tasks>
      </configuration>
    </execution>
  </executions>
</plugin>

maven antrun插件
安装

maven antrun插件
安装
跑

问题是你为什么喜欢这样做?因为看起来你是在当前项目之外复制的,这不是Maven的意图。这看起来更像是部署工具的工作,而Maven不是。Ant任务是一种方法,但最好从maven外部解决。您建议使用什么工具来实现这一目的?
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <configuration>
                <tasks>
                    <copy file="target/myfile.jar" tofile="D:/Bukkit/plugins/myfile.jar"/>
                </tasks>
            </configuration>
            <executions>
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>