Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Greetings to all. I'm telling you, I'm developing a project in netbeans 8.2 with java and spring (I'm new to this), I started it with start.spring.io. Look, this error appears when I run my project.

Terminal
Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.3:run (default-cli) on project almacendemo: Application finished with exit code: 1 -> [Help 1]


failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) there are test failures


I really don't know what the errors are due to, I think it's a maven version problem.

I share more details of the project so they help me.

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 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.7.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.matias</groupId>
    <artifactId>almacendemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>almacendemo</name>
    <description>Demo de proyecto sistema de ventas para almacen</description>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <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.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity5</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>     
        </plugins>
    </build> 
</project>


APPLICATION.PROPERTIES

Java
spring.datasource.url: jdbc:mysql://localhost:3306/almacen?allowPublicKeyRetrieval=true&useSSL=false&useTimezone=true&serverTimezone=GMT&characterEncoding=UTF-8
spring.datasource.username: root
spring.datasource.password: root
spring.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
spring.jpa.show-sql: true
spring.jpa.hibernate.ddl-auto: update
spring.jpa.properties.hibernate.dialect: org.hibernate.dialect.MySQL5InnoDBDialect
spring.thymeleaf.cache: false



MAVEN VERSION
https://i.stack.imgur.com/Xp6LL.jpg

MAVEN INSTALLED IN NETBEANS
https://i.stack.imgur.com/UtgRX.jpg

JDP PROYECT
https://i.stack.imgur.com/jtmIE.jpg

ENVIRONMENT VARIABLES
https://i.stack.imgur.com/lq9ZE.jpg

Thank you all for your attention!

What I have tried:

To solve this error, I read in a forum that mvn clean install must be executed in the terminal, but after doing so I got the following error (which I couldn't solve either)

Terminal
failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) there are test failures
Posted
Updated 11-May-23 2:21am

related to this post.

can you downgrade / upgrade version of this library?
maven-surefire-plugin


You can search version here.


You can try this :


Here is the simplest way to resolve this error:

1) Go to your pom.xml file path

2) And edit the pom.xml like:
XML
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12</version>
    </plugin>
</plugins>
 
Share this answer
 
Fixed test error by adding to pom:

XML
<plugin>     
<groupId>org.apache.maven.plugins</groupId>     
<artifactId>maven-surefire-plugin</artifactId>     
<version>2.19.1</version>     
<dependencies>         
<dependency>             
<groupId>org.apache.maven.surefire</groupId>             
<artifactId>surefire-junit47</artifactId>             
<version>2.19.1</version>         
</dependency>     
</dependencies> 
</plugin>


The main error still persists
 
Share this answer
 
you can try this:

Here is the simplest way to resolve this error:

1) Go to your pom.xml file path

2) And edit the pom.xml like:



<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12</version>
    </plugin>
</plugins>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900