为什么maven会忽略add-source-goal?

时间:2016-04-29 08:14:37

标签: eclipse maven

这是我的pom.xml的构建部分。我整个项目只有一个pom.xml。

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>build-helper-maven-plugin</artifactId>
                                    <versionRange>[1.1,)</versionRange>
                                    <goals>
                                        <goal>add-source</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/projects</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <dependencies>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.5</version>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/jar-dep.xml</descriptor>
                        <descriptor>src/main/assembly/src-zip.xml</descriptor>
                        <descriptor>src/main/assembly/bin-zip.xml</descriptor>
                    </descriptors>
                    <archive>
                        <manifest>
                            <mainClass>myProject.Main</mainClass>
                        </manifest>
                    </archive>
                    <appendAssemblyId>true</appendAssemblyId>
                    <archiverConfig>
                        <compress>true</compress>
                    </archiverConfig>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

如果我删除-tags,它就可以正常编译,但是eclipse抱怨如下:生命周期配置不包含插件执行:org.codehaus.mojo:build-helper-maven-plugin:1.1:add-source(execution :add-source,phase:generate-sources)

如果我留下标签,eclipse在pom.xml中没有显示错误,但是其他来源没有编译,也没有添加到jar文件中。有什么问题?

0 个答案:

没有答案