ProgramingTip

m2e 수명주기 매핑을 수 없습니다.

bestdevel 2020. 12. 14. 20:39
반응형

m2e 수명주기 매핑을 수 없습니다.


여기설명 된 솔루션을 사용하여 성가신 "수명주기 구성에 포함되지 않는 것 실행 : org.codehaus.mojo : build-helper-maven-plugin : 1.7 : add-source (실행 : 실행, 단계 : 소스 생성-) "내 pom.xml에 다음 설치를 배치 할 때 :

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
    <execution>
        <phase>generate-sources</phase>
        <goals><goal>add-source</goal></goals>
        <configuration>
            <sources>
                <source>src/bootstrap/java</source>
            </sources>
        </configuration>
    </execution>
</executions>
</plugin>

하지만 mvn clean install을 실행하면 다음과 같이 표시됩니다.

이유 : 저장소에서 POM 'org.eclipse.m2e : lifecycle-mapping'을 사용할 수 없음 : 저장소에서 아티팩트를 다운로드 할 수 없습니다.

m2e와 maven을 행복하게 만드는 방법에 대한 단서가 있습니까?


org.eclipse.m2e:lifecycle-mapping플러그인은 실제로 존재하지 않습니다. <build><pluginManagement>섹션 에서에서 합니다 pom.xml. 이렇게하면 Maven에서는 해결되지 않지만 m2e에서 읽을 수 없습니다.

그러나 문제에 대한 더 해결책은 이클립스에 m2e 빌드 도우미를 설치하는 것입니다. 당신은에서 설치할 수 있습니다 Window> Preferences> Maven> Discovery> Open Catalog. 그 방법 build-helper-maven-plugin:add-sources은 당신이 당신의 pom.xml.


build/pluginManagement섹션을 검색합니다 . 예 :

<pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                        <pluginExecution>
                            <pluginExecutionFilter>
                                <groupId>org.bsc.maven</groupId>
                                <artifactId>maven-processor-plugin</artifactId>
                                <versionRange>[2.0.2,)</versionRange>
                                <goals>
                                    <goal>process</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <execute />
                            </action>
                        </pluginExecution>
                    </pluginExecutions>                         
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>

Eclipse 내에서 증분을 생성 할 수있는 많은 매니페스트를 생성합니다.

<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.felix</groupId>
                                    <artifactId>maven-bundle-plugin</artifactId>
                                    <versionRange>[1.0.0,)</versionRange>
                                    <goals>
                                        <goal>manifest</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>2.3.7</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                </instructions>
            </configuration>
            <executions>
                <execution>
                    <id>manifest</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>manifest</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

versionRange는 필수이며 생략 된 경우 m2e (1.1.0 기준)는 NullPointerException을 발생 수정합니다.


이 더미 플러그인을 사용할 수 있습니다.

mvn archetype:generate -DgroupId=org.eclipse.m2e -DartifactId=lifecycle-mapping -Dversion=1.0.0 -DarchetypeArtifactId=maven-archetype-mojo

프로젝트를 생성 한 후 설치 / 배포합니다.


방법은 다음과 가변합니다. m2e의 수명주기 매핑 플러그인을 기본 <build> 대신 별도의 프로필에 넣습니다. 프로필은 m2e 속성의 존재에 의해 Eclipse 빌드 중에 자동 활성화됩니다 (settings.xml 또는 기타에서 수동 활성화 대신). 이 m2e 케이스를 처리 할 수있는 명령 줄 maven은 경고없이 프로필과 m2e 라이프 사이클 매핑을 건너 뛰기 만하면가 만족합니다.

<project>
  ...
  <profiles>
    ...
    <profile>
      <id>m2e</id>
      <!-- This profile is only active when the property "m2e.version"
        is set, which is the case when building in Eclipse with m2e. -->
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.eclipse.m2e</groupId>
              <artifactId>lifecycle-mapping</artifactId>
              <version>1.0.0</version>
              <configuration>
                <lifecycleMappingMetadata>
                  <pluginExecutions>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>...</groupId>
                        <artifactId>...</artifactId>
                        <versionRange>[0,)</versionRange>
                        <goals>
                          <goal>...</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>

                        <!-- either <ignore> XOR <execute>,
                          you must remove the other one. -->

                        <!-- execute: tells m2e to run the execution just like command-line maven.
                          from m2e's point of view, this is not recommended, because it is not
                          deterministic and may make your eclipse unresponsive or behave strangely. -->
                        <execute>
                          <!-- runOnIncremental: tells m2e to run the plugin-execution
                            on each auto-build (true) or only on full-build (false). -->
                          <runOnIncremental>false</runOnIncremental>
                        </execute>

                        <!-- ignore: tells m2eclipse to skip the execution. -->
                        <ignore />

                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    ...
  </profiles>
  ...
</project>

m2e에서 이에 대한 (사소한) 버그를 열었습니다. 경고 메시지를 없애고 일괄 투표하세요 ...

https://bugs.eclipse.org/bugs/show_bug.cgi?id=367870


동일한 문제가 발생했습니다.

Eclipse에서 build-helper-maven-plugin : 1.8 : add-source를 처리하는 마켓 플레이스 항목이 없습니다. 자세한 내용은 도움말을 참조하십시오.

창> 환경 설정> Maven> 발견> 카탈로그 열기 버튼을 클릭하면 연결이 없다고보고됩니다.

Centos 6.4 및 OSX에서 7u40에서 7u45로 업데이트하면 문제가 해결됩니다.


Maven은 M2E가 Eclipse 내에서 플러그인을 처리하는 방법 (소스 폴더 추가 등)을 결정하는 데 사용하는 m2e의 수명주기 매핑 아티팩트를 다운로드하려고합니다. 어떤 이유로이 아티팩트를 다운로드 할 수 없습니다. 인터넷에 연결되어 있습니까? 저장소에서 다른 아티팩트를 다운로드 할 수 있습니까? 프록시 설정?

Maven에서 자세한 내용을 보려면 M2E 디버그 출력을 켜십시오 (Settings / Maven / Debug Output 확인란). 그러면 저장소에서 다운로드 할 수없는 이유에 대한 자세한 정보를 얻을 수 있습니다.


m2e 1.7에는 더 이상이 경고를 발생시키지 않는 수명주기 매핑 메타 데이터에 대한 새로운 구문이 도입되었습니다 .

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
    <execution>

        <!-- This executes the goal in Eclipse on project import.
             Other options like are available, eg ignore.  -->
        <?m2e execute?>

        <phase>generate-sources</phase>
        <goals><goal>add-source</goal></goals>
        <configuration>
            <sources>
                <source>src/bootstrap/java</source>
            </sources>
        </configuration>
    </execution>
</executions>
</plugin>

플러그인 구성이 누락되어 발생합니다 ( vaadin의 데모 pom.xml 주석에 따라).

이 플러그인의 구성은 Eclipse m2e 설정 만 저장하는 데 사용됩니다. Maven 빌드 자체에는 영향을 미치지 않습니다.

<pluginManagement>
    <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e ettings 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>com.vaadin</groupId>
                                <artifactId>
                                    vaadin-maven-plugin
                                </artifactId>
                                <versionRange>
                                    [7.1.5,)
                                </versionRange>
                                <goals>
                                    <goal>resources</goal>
                                    <goal>update-widgetset</goal>
                                    <goal>compile</goal>
                                    <goal>update-theme</goal>
                                    <goal>compile-theme</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <ignore></ignore>
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>

놀랍게도 다음 3 단계가 도움이되었습니다.

mvn clean
mvn package
mvn spring-boot:run

이 단계는 나에게 작동합니다. 1. Eclipse에서 프로젝트를 제거합니다. 2. 프로젝트를 다시 가져옵니다. 3. 프로젝트에서 대상 폴더를 삭제합니다. 4. mvn 또는 mvnw install

참고 URL : https://stackoverflow.com/questions/7409823/m2e-lifecycle-mapping-not-found

반응형