项目结构
-MyProject
|_ project1
|_ dist
|_ app
|_ config
|_ pom.xml
|_ project2
|_ pom.xml
我尝试了以下另一种方法,但是没有用。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install-jar</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>MyProject</groupId>
<artifactId>project1</artifactId>
<version>1.0.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/assets/</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
我想使用Maven将 dist 从 project1 复制到 project2 。谁能告诉我该怎么做。谢谢。
答案 0 :(得分:0)
我总是将Wagon Maven Plugin用于此类情况:
使用此插件可以使用Maven Wagon在存储库之间查看和传输资源。
答案 1 :(得分:0)
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-dist</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/assets</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>../project1/dist/</directory>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>