Error Plugins in Spring project

0

I am trying to create my first project with Spring. I miss two mistakes:

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:3.1.0:testResources (execution: default-testResources, phase: process-test-
 resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:3.1.0:resources (execution: default-resources, phase: process-resources)

The pom.xml file is as follows

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org /xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.udemy</groupId>
<artifactId>backendninja</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>backendninja</name>
<description>Demo project for Spring Boot</description>

/*ERROR AQUÍ*/<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

    
asked by Inca 02.11.2018 в 12:22
source

1 answer

2

It's a problem of Maven's integration with Eclipse (the Eclipse plugin m2e ).

In short, like any other Eclipse IDE, it is constantly recompiling the project to be able to offer error detection, suggestions of class names and methods, documentation tips, etc.

The problem is that Maven has a philosophy of working by blocks: you launch a process and wait for it to end. Depending on your project, it may take a while (eg plugins to generate code automatically depending on WSDL or other resources, testing, etc.).

Since you do not want every time you save a file to run everything at least until the goal compile , and also some plugins can have memory leaks 1 what makes m2e by default is to execute only certain goals , and show a warning for the plugins associated with goals that are not going to run.

In your case, that plugin configuration is inherited from spring-boot-starter-parent .

The solution to the error message comes in the m2e ; it's about configuring the plugin m2e to tell you either to ignore the affected plugins , or to execute them when doing the build :

<pluginManagement>
  <plugins>
    <plugin>
      <groupId>org.eclipse.m2e</groupId>
      <artifactId>lifecycle-mapping</artifactId>
      <version>1.0.0</version>
      <configuration>
        <lifecycleMappingMetadata>
          <pluginExecutions>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>some-group-id</groupId>
                <artifactId>some-artifact-id</artifactId>
                <versionRange>[1.0.0,)</versionRange>
                <goals>
                  <goal>some-goal</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <execute>
                  <runOnIncremental>false</runOnIncremental>
                </execute >
                <!-- o <ignore/> -->
              </action>
            </pluginExecution>
          </pluginExecutions>
        </lifecycleMappingMetadata>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>

If you make <ignore/> , you may have to throw a mvn package "by hand" (even from the Eclipse) every so often so that the necessary steps are executed (for example, automatic code generation).

1 After all, they are meant to be executed in a Maven build that is normally a process that launches a JVM, executes and closes the JVM.     
answered by 02.11.2018 в 13:12