我试图让maven复制一些资源(特别是母版.css文件)从一个核心模块到依赖它的所有模块。
我试图用这个问题的第一个答案:
Use a dependency's resources?
:
<build>
<plugins>
<!--Extract core's resources-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>${project.groupId}</includeGroupIds>
<includeArtifactIds>core</includeArtifactIds>
<excludeTransitive>true</excludeTransitive>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/core-resources</outputDirectory>
<excludes>org/**,META-INF/**,rebel.xml</excludes>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!--New resource locations-->
<resources>
<resource>
<filtering>false</filtering>
<directory>${project.build.directory}/core-resources</directory>
</resource>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</build>
以下是mvn clean install时该部件的输出:
--- maven-dependency-plugin:2.1:unpack-dependencies (unpack) @ Core ---
--- maven-resources-plugin:3.0.2:resources (default-resources) @ Core ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory {project-directory}\Core\target\core-resources
Copying 16 resources
其中{project directory}是指向我的项目的完整路径。
我的核心资源文件夹如下所示:
src/main/resources
/core-resources
master.css
/fxml
~some stuff~
/imgs
~some stuff~
/styles
~some stuff~
在依赖于核心的模块的目标目录中,我没有看到任何被复制的内容。
基本上,我有三个问题:
它是从哪里复制的?
为什么它现在不复制任何东西?