java – Have updated spring to 2.5.12, however my project isn’t running and says no junit 5 tests found, below is output

here is my pom file, I upgrade from 2.3.4 to 2.5.12 for springboot version I also updated my spring-cloud version from Hoxton.SR3 to 2020.0.5 and added in 1.1.2.RELEASE under the “spring-cloud- starter-kubernetes-config” artifactID.

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.12</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    
    <groupId>com.sams.pricing</groupId>
    <artifactId>sams-comp-rules-api</artifactId>
    <version>1.0.20-SNAPSHOT</version>
    <packaging>jar</packaging> 
    
    <name>sams-comp-rules-api</name>
    <description>Sams Comp Rules API</description>

    <properties>
        <java.version>11</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <apache.maven-release-plugin.version>2.5.3</apache.maven-release-plugin.version>
        <ccm.client.version>2.0.8</ccm.client.version>
        <functionalTeamName>pricing</functionalTeamName>
        <spring-cloud.version>2020.0.5</spring-cloud.version>
        <google.cloud.version>3.3.0</google.cloud.version>
        <!--        Sonar Properties  -->   
        <jacoco.version>0.8.6</jacoco.version>
        <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version>
        <sonar.language>java</sonar.language>
        <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <coverage.reports>${project.build.directory}/coverage-reports</coverage.reports>
        <jacoco.out.ut.file>${coverage.reports}/jacoco-ut.exec</jacoco.out.ut.file>
        <jacoco.out.it.file>${coverage.reports}/jacoco-it.exec</jacoco.out.it.file>
        <jacoco.out.merged.file>${coverage.reports}/merged-report.exec</jacoco.out.merged.file>
        <sonar.jacoco.itReportPaths>${coverage.reports}/jacoco-it.exec</sonar.jacoco.itReportPaths>
        <sonar.coverage.jacoco.xmlReportPaths>${coverage.reports}/coverage-report-merged/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
        <sonar.coverage.exclusions>
            **/util/*,**/config/*,**/enums/*,**/jsonmodel/*,**/exception/*,**/application/*,**/repository/*,**/model/*,**/multitenant/*,
            **/dto/*,src/main/java/com/sams/pricing/comprules/CompRulesApiApplication.java
        </sonar.coverage.exclusions>
        
        <!-- Metrics related dependencies -->
        <micrometer-version>1.5.1</micrometer-version>
        <version.strati.starter>3.2.0</version.strati.starter>
        <version.prometheus.simpleclient>0.9.0</version.prometheus.simpleclient>
        <pricing-commons.version>1.2.3</pricing-commons.version>
        <pricing-security-lib.version>1.0.9</pricing-security-lib.version> 
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>libraries-bom</artifactId>
                <version>${google.cloud.version}</version>
                <type>pom</type>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</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-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>org.apache.directory.studio</groupId>
            <artifactId>org.apache.commons.codec</artifactId>
            <version>1.8</version>
        </dependency>
        
        <dependency>
           <groupId>com.microsoft.sqlserver</groupId>
           <artifactId>mssql-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            </dependency>

        <!-- Swagger : API Documentation -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.8.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.javassist</groupId>
                    <artifactId>javassist</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.8.0</version>
        </dependency>
        <dependency>
            <groupId>io.strati.tunr.utils</groupId>
            <artifactId>strati-af-tunr-utils-client-spring</artifactId>
            <version>${ccm.client.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-kubernetes-config</artifactId>
             <version>1.1.2.RELEASE</version>
        </dependency>

        <!-- metrics and prometheus settings -->
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-core</artifactId>
        </dependency>

<!--        <dependency>-->
<!--            <groupId>io.strati.ioc</groupId>-->
<!--            <artifactId>strati-af-ccm-spring-boot-starter</artifactId>-->
<!--            <version>2.2.0</version>-->
<!--            <exclusions>-->
<!--                <exclusion>-->
<!--                    <groupId>com.walmart.platform.logging</groupId>-->
<!--                    <artifactId>logging-log4j2-slf4j-impl</artifactId>-->
<!--                </exclusion>-->
<!--            </exclusions>-->
<!--        </dependency>-->

<!--        <dependency>-->
<!--            <groupId>io.micrometer</groupId>-->
<!--            <artifactId>micrometer-registry-prometheus</artifactId>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>io.prometheus</groupId>-->
<!--            <artifactId>simpleclient</artifactId>-->
<!--            <version>${version.prometheus.simpleclient}</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>io.prometheus</groupId>-->
<!--            <artifactId>simpleclient_spring_boot</artifactId>-->
<!--            <version>${version.prometheus.simpleclient}</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>io.prometheus</groupId>-->
<!--            <artifactId>simpleclient_hibernate</artifactId>-->
<!--            <version>${version.prometheus.simpleclient}</version>-->
<!--        </dependency>-->
<!--        <dependency>-->
<!--            <groupId>io.prometheus</groupId>-->
<!--            <artifactId>simpleclient_logback</artifactId>-->
<!--            <version>${version.prometheus.simpleclient}</version>-->
<!--        </dependency>-->
        <dependency>
            <groupId>com.sams.pricing</groupId>
            <artifactId>commons</artifactId>
            <version>${pricing-commons.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sams.pricing</groupId>
            <artifactId>pricing-security-lib</artifactId>
            <version>${pricing-security-lib.version}</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-info</id>
                        <goals>
                            <goal>build-info</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <forkCount>3C</forkCount><!--Number of parallel JVM = 3 times the number 
                        of available processors -->
                    <reuseForks>true</reuseForks>
                    <testFailureIgnore>false</testFailureIgnore>
                    <argLine>${surefireArgLine}</argLine>
                    <includes>
                        <include>**/*Test*</include>
                    </includes>
                    <excludes>
                        <exclude>**/FT/**</exclude>
                        <exclude>**/*IT*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>1.18.12</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
                <executions>
                    <execution>
                        <id>run-annotation-processors-only</id>
                        <phase>generate-sources</phase>
                        <configuration>
                            <compilerArgument>-proc:only</compilerArgument>
                        </configuration>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <updateDependencies>true</updateDependencies>
                    <localCheckout>true</localCheckout>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <propertyName>coverageAgent</propertyName>
                    <append>true</append>
                    <excludes>
                        <exclude>**/application/*</exclude>
                        <exclude>**/dto/*</exclude>
                        <exclude>**/jsonmodel/*</exclude>
                        <exclude>**/model/*</exclude>
                        <exclude>**/exception/*</exclude>
                        <exclude>**/enums/*</exclude>
                        <exclude>**/repository/*</exclude>
                        <exclude>**/util/*</exclude>
                        <exclude>**/config/*</exclude>
                        <exclude>**/multitenant/*</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                        <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${coverage.reports}/jacoco-ut.exec</destFile>
                            <propertyName>surefireArgLine</propertyName>
                            <append>true</append>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                        <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${coverage.reports}/jacoco-ut.exec</dataFile>
                            <outputDirectory>${coverage.reports}/coverageReport</outputDirectory>
                            <append>true</append>
                        </configuration>
                    </execution>
                    <execution>
                        <id>pre-integration-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                             <destFile>${coverage.reports}/jacoco-it.exec</destFile>
                            <propertyName>failsafeArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-integration-test</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <append>true</append>
                            <dataFile>${coverage.reports}/jacoco-it.exec</dataFile>
                            <outputDirectory>${coverage.reports}/coverageReport</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>merge-unit-and-integration</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>merge</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <directory>${coverage.reports}</directory>
                                    <includes>
                                        <include>*.exec</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                            <destFile>${jacoco.out.merged.file}</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>merge-reports</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${jacoco.out.merged.file}</dataFile>
                            <outputDirectory>${coverage.reports}/coverage-report-merged</outputDirectory>
                        </configuration>
                    </execution>
                    <!-- Line coverage plugin -->
                    <execution>
                        <id>coverage-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <dataFile>${jacoco.out.merged.file}</dataFile>
                            <rules>
                                <rule>
                                    <element>BUNDLE</element>
                                    <limits>
                                        <limit>
                                            <counter>LINE</counter>
                                            <value>COVEREDRATIO</value>
                                            <minimum>0.80</minimum>
                                        </limit>
                                    </limits>
                                </rule>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
              </plugin>
        </plugins>
    </build>
    <distributionManagement>
        <repository>
            <id>internal-repository</id>
            <name>Walmart Releases</name>
            <url>https://pxlegacy.walmart.com/content/repositories/walmart</url>
        </repository>

        <snapshotRepository>
            <id>internal-repository</id>
            <name>Walmart Snapshots</name>
            <url>https://pxlegacy.walmart.com/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>
</project>

This is the output I get when I try to run the project

“Selection does not contain a main type”

when I try to run my Junit tests

“no tests found with test runner Junit5”

Leave a Comment