m2 eclipse plugin이 1.0 버전 업하면서 생긴 단순한 설정은 아래와 같이 처리한다.
http://knight76.tistory.com/entry/이클립스-STS-maven-builder-변경


컴파일을 잘 되는데, pom.xml 파일에 maven parent를 사용하는 부분에서 에러가 있다고 나온다. build life cycle에서 무엇인가 이슈가 있다.

 

원인을 찾아보니, 이클립스 싸이트의 m2e 플러그인에 대한 내용이 있다. 간단히 요약해보면 다음과 같다. 빌드시 명시적으로 문제의 소지가 있는 플러그인에 대해서 에러로 처리할테니, 무시하든지 추가하든지 하는 설정을 넣으라는 얘기이다. (m2eclipse 플러그인 개발자도 maven 때문에 고생한다…. )

http://wiki.eclipse.org/M2E_plugin_execution_not_covered

https://issues.sonatype.org/browse/MNGECLIPSE-823에 내용에 있는 것처럼 리소스들과 컴파일이 안되는 문제가 발생되기도 했다. 0.12 버전 이하에서는 이클립스 빌드시 maven을 사용해서 컴파일을 했었다. 사실 이클립스 플러그인 개발입장에서는 그저 maven에 위임하는데, 어떤 “ Plug excution”이 동작하여 예상치 못하게 파일(리소스)가 날아가(missing) 버리거나 JVM, OS 리소스 부족으로 문제를 일으키는 경우가 있었다.

이 문제를 해결해가 위해서 1.0 부터는 빌드 lifecycle에 명확한 방법(explicit instructions)을 제공하였다. 이것을 “project build lifecycle mapping” (lifecycle mapping)이라고  한다. pom.xml 설정에 maven 빌드와 별도로플러그 실행(execution)에 대한 정보를 넣을 수 있게 하였다.

예를 들어 project build lifecycle mapping 정보가 없는 경우에 대해서는 다음과 같이 m2 이클립스 플러그인에서 에러로 처리한다고 한다.

Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-antrun-plugin:1.3:run
    (execution: generate-sources-input, phase: generate-sources)
이 문제를 해결하기 위해서 ignore 또는 execute goal을 넣어야 한다. 

 

아래 에러 로그에 있는 내용이 바로 위에 작성한 위키의 내용과 일치한다.

Multiple annotations found at this line:
    - Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:xml-maven-plugin:1.0:transform
     (execution: default, phase: process-resources)
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.3:run
     (execution: process-resources, phase: process-resources)
    - maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e.
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.3:run
     (execution: copy-base-resource, phase: generate-sources)

 

이 방식을 이용해서 아래와 같이 pom.xml 파일에 정리하였더니 더 이상 이클립에서 에러라고 처리되지 않는다.

<build>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings
                    only. It has no influence on the Maven build itself. -->
                <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-antrun-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.3,)
                                        </versionRange>
                                        <goals>
                                            <goal>run</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.codehaus.mojo
                                        </groupId>
                                        <artifactId>
                                            xml-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.0,)
                                        </versionRange>
                                        <goals>
                                            <goal>transform</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-dependency-plugin</artifactId>
                                        <versionRange>[1.0.0,)</versionRange>
                                        <goals>
                                            <goal>copy-dependencies</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

Posted by '김용환'
,