m2e lifecycle-mapping not found


Estoy tratando de usar la solución descrita aquí para resolver la molesta "Ejecución del plugin no cubierta por lifecycle configuration: org.codehaus.mojo: build-helper-maven-plugin:1.7:add-source (execution: default, phase: generate-sources)" cuando coloco el siguiente plugin en mi 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>

Pero cuando corro mvn clean install obtengo esto:

Razón: POM ' org.eclipsar.m2e: lifecycle-mapping ' not found in repository: Unable to download the artifact from any repositorio

¿Alguien tiene idea de cómo hacer felices a m2e y maven?

Author: falsarella, 2011-09-14

9 answers

El complemento org.eclipse.m2e:lifecycle-mapping no existe en realidad. Debe usarse desde la sección <build><pluginManagement> de su pom.xml. De esa manera, no es resuelto por Maven, pero puede ser leído por m2e.

Pero una solución más práctica a su problema sería instalar el conector m2e build-helper en eclipse. Se puede instalar desde el Window > Preferences > Maven > Discovery > Open Catalog. De esa manera build-helper-maven-plugin:add-sources sería llamado en eclipse sin tener que cambiar su pom.xml.

 106
Author: Fred Bricon,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-24 14:22:50

Intente usar la sección build/pluginManagement, por ejemplo:

<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>

Aquí hay un ejemplo para generar manifiesto de paquete durante la compilación incremental dentro de 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>

Se requiere VersionRange, si se omite m2e (a partir de 1.1.0) lanzará NullPointerException.

 10
Author: Hendy Irawan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-07-15 08:55:50

Puede usar este complemento ficticio:

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

Después de generar el proyecto instalarlo/desplegarlo.

 8
Author: Manfred Hantschel,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-02-14 11:22:15

Así es como lo hago: pongo el complemento de mapeo de ciclo de vida de m2e en un perfil separado en lugar de la sección predeterminada . el perfil se activa automáticamente durante las compilaciones de eclipse mediante la presencia de una propiedad m2e (en lugar de la activación manual en ajustes.xml o de otro modo). esto manejará los casos m2e, mientras que maven de línea de comandos simplemente omitirá el perfil y el plugin de mapeo de ciclo de vida de m2e sin advertencias, y todo el mundo está feliz.

<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>
 4
Author: Robin479,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-02-05 10:14:36

He abierto un error (trivial) para esto en m2e. Vota por él si quieres que el mensaje de advertencia desaparezca para siempre...

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

 3
Author: Ben,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-01-04 16:39:11

Estaba teniendo el mismo problema, donde:

No se encontraron entradas del mercado para manejar build-helper-maven-plugin: 1.8: add-source en Eclipse. Consulte Ayuda para obtener más información.

Y haciendo clic en el botón Ventana > Preferencias > Maven > Descubrimiento > abrir catálogo reportaría que no hay conexión.

La actualización de 7u40 a 7u45 en Centos 6.4 y OSX soluciona el problema.

 3
Author: user145880,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-16 19:25:27

Maven está tratando de descargar el artefacto de mapeo de ciclo de vida de m2e, que M2E usa para determinar cómo procesar complementos dentro de Eclipse (agregar carpetas de origen, etc.).). Por alguna razón este artefacto no se puede descargar. ¿Tiene conexión a Internet? ¿Se pueden descargar otros artefactos de los repositorios? Configuración de Proxy?

Para obtener más detalles de Maven, intente activar la salida de depuración M2E (casilla de verificación Settings/Maven/Debug Output) y podría darle más detalles sobre por qué no puede descarga desde el repositorio.

 1
Author: prunge,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-09-14 03:56:32

M2e 1.7 introduce una nueva sintaxis para metadatos de mapeo de ciclo de vida que ya no causa esta advertencia:

<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>
 1
Author: Arend v. Reinersdorff,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-14 19:13:31

Sucede debido a una falta de configuración de plugin (según pom demo de vaadin.xml comentario):

La configuración de este plugin se utiliza para almacenar la configuración de Eclipse m2e solo. No tiene influencia en la propia construcción 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>
 0
Author: falsarella,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-27 19:55:42