[maven]Multiple annotations found at this line

旧版本m2e插件报以下错:
引用

Multiple annotations found at this line:
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-
compiler-plugin:3.0:compile (execution: default-compile, phase: compile)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-
compiler-plugin:3.0:testCompile (execution: default-testCompile, phase: test-compile)


解决办法,在pom中加入如下配置:
<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.apache.maven.plugins</groupId>
									<artifactId>maven-resources-plugin</artifactId>
									<versionRange>[2.0,)</versionRange>
									<goals>
										<goal>resources</goal>
										<goal>testResources</goal>
									</goals>
								</pluginExecutionFilter>
								<action>
									<ignore />
								</action>
							</pluginExecution>
							<pluginExecution>
								<pluginExecutionFilter>
									<groupId>org.apache.maven.plugins</groupId>
									<artifactId>maven-compiler-plugin</artifactId>
									<versionRange>[2.0,)</versionRange>
									<goals>
										<goal>compile</goal>
										<goal>testCompile</goal>
									</goals>
								</pluginExecutionFilter>
								<action>
									<ignore />
								</action>
							</pluginExecution>
						</pluginExecutions>
					</lifecycleMappingMetadata>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>
</build>


该解决办法有副作用,其中一个见: http://vivus.iteye.com/blog/1741102

这是m2e插件的bug,建议还是升级m2e插件才是根本解决办法。

你可能感兴趣的:(Annotations)