I'm getting this error while doing mvn clean install
this error happened just after integrating sonarqube.
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.4:run (default) on project bootloader: Unable to parse configuration of mojo org.springframework.boot:spring-boot-maven-plugin:2.6.4:run for parameter include: Cannot find default setter in class org .springframework.boot.maven.Include -> [Help 1]
pom.xml
<?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>io.releve</groupId>
<artifactId>releveproject</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>application</module>
<module>bootloader</module>
<module>domain</module>
<module>infrastructure</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-core</artifactId>
<version>3.8.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<application.name.value>relevebancaire</application.name.value>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
<sonar.organization>ibrahimbakhaled</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.exclusions>
**/*BootloaderApplicationLauncher.java,
**/*Configuration.java,
**/config/**,
**/domain/**,
**/adapter/**,
**/entity/**,
**/repository/**,
**/api/**,
**/**Test**/**,
**/cdg.releve/**
</sonar.exclusions>
<sonar.jdbc.dialect>mysql</sonar.jdbc.dialect>
<sonar.projectName>${application.name.value}</sonar.projectName>
<sonar.projectVersion>0.0.1-SNAPSHOT</sonar.projectVersion>
<sonar.language>java</sonar.language>
<sonar.binaries>build/classes</sonar.binaries>
<sonar.sources>src</sonar.sources>
<sonar.tests>src/test</sonar.tests>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.4</version>
<configuration>
<skip>true</skip>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.0.905</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
CodePudding user response:
It looks like you're using inconsistent versions of Spring Boot and Spring
Framework. I suggest getting more of your dependencies from
spring-boot-dependencies
:
<?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>io.releve</groupId>
<artifactId>releveproject</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>application</module>
<module>bootloader</module>
<module>domain</module>
<module>infrastructure</module>
</modules>
<properties>
<application.name.value>relevebancaire</application.name.value>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.1.3.RELEASE</spring-boot.version>
<sonar.organization>ibrahimbakhaled</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.exclusions>
**/*BootloaderApplicationLauncher.java,
**/*Configuration.java,
**/config/**,
**/domain/**,
**/adapter/**,
**/entity/**,
**/repository/**,
**/api/**,
**/**Test**/**,
**/cdg.releve/**
</sonar.exclusions>
<sonar.jdbc.dialect>mysql</sonar.jdbc.dialect>
<sonar.projectName>${application.name.value}</sonar.projectName>
<sonar.projectVersion>0.0.1-SNAPSHOT</sonar.projectVersion>
<sonar.language>java</sonar.language>
<sonar.binaries>build/classes</sonar.binaries>
<sonar.sources>src</sonar.sources>
<sonar.tests>src/test</sonar.tests>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<skip>true</skip>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.0.905</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
Note the reduced dependency management and the version used for
spring-boot-maven-plugin
.
You can further reduce the size/complexity of your POM if you use
spring-boot-dependencies
as your parent POM:
<?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>io.releve</groupId>
<artifactId>releveproject</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/>
</parent>
<modules>
<module>application</module>
<module>bootloader</module>
<module>domain</module>
<module>infrastructure</module>
</modules>
<properties>
<application.name.value>relevebancaire</application.name.value>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<sonar.organization>ibrahimbakhaled</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.exclusions>
**/*BootloaderApplicationLauncher.java,
**/*Configuration.java,
**/config/**,
**/domain/**,
**/adapter/**,
**/entity/**,
**/repository/**,
**/api/**,
**/**Test**/**,
**/cdg.releve/**
</sonar.exclusions>
<sonar.jdbc.dialect>mysql</sonar.jdbc.dialect>
<sonar.projectName>${application.name.value}</sonar.projectName>
<sonar.projectVersion>0.0.1-SNAPSHOT</sonar.projectVersion>
<sonar.language>java</sonar.language>
<sonar.binaries>build/classes</sonar.binaries>
<sonar.sources>src</sonar.sources>
<sonar.tests>src/test</sonar.tests>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.0.905</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
This technique allows you to override Spring Boot dependency version
properties defined in spring-boot-dependencies
simply by defining the same
property in you POM <properties/>
with the version you want to use.
CodePudding user response:
Cannot find default setter in class org.springframework.boot.maven.Include
The error message gives you the hint what is wrong.
The include
element should contain groupId
and artifactId
instead of **/*Test.java
(are you putting something wrong here?) according to spring boot maven plugin document, so the pom should look like
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.6.4</version>
<configuration>
<skip>true</skip>
<includes>
<include>
<groupId>some-groupId</groupId>
<artifactId>some-artifactId</artifactId>
</include>
</includes>
</configuration>
</plugin>