Maven远程资源插件未创建remote-resources.xml清单文件

时间:2014-04-15 14:48:58

标签: java maven

我有一个多模块Maven项目,它在模块中使用相同的资源文件。我创建了资源项目并将资源添加到src / main / resources文件夹中。 这是我的pom.xml文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>project-resources</artifactId>
<version>0.0.1</version>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>bundle</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>**/*.*</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

当我进行构建时,不会创建META-INF / maven / remote-resources.xml文件。 我做错了吗?

2 个答案:

答案 0 :(得分:4)

尝试:

   <pluginManagement>
        <plugins>
             ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <version>1.5</version>
            </plugin>
            ...
        </plugins>
    </pluginManagement>
    <plugins>
        ...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-remote-resources-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>bundle</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <includes>
                    <include>**/*</include>
                </includes>
            </configuration>
        </plugin>
        ...
    </plugins>

换句话说:还要将它添加到插件部分,而不仅仅是插件管理部分。

答案 1 :(得分:3)

关于你遇到的执行警告 - 这是eclipse中一个已知的“问题”。您可以通过配置目标委派来处理它:

<pluginManagement>
      <plugins>
        <plugin>
         <groupId>org.eclipse.m2e</groupId>
         <artifactId>lifecycle-mapping</artifactId>
         <version>1.0.0</version>
         <configuration>
           <lifecycleMappingMetadata>
             <pluginExecutions>
               <pluginExecution>
                 <pluginExecutionFilter>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-remote-resources-plugin</artifactId>
                   <versionRange>[1.0.0,)</versionRange>
                   <goals>
                     <goal>bundle</goal>
                   </goals>
                 </pluginExecutionFilter>
                 <action>
                   <ignore/>
                 </action>
               </pluginExecution>
             </pluginExecutions>
           </lifecycleMappingMetadata>
         </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html