Maven , build-failure-erreur plugin

Résolu
etbienwi Messages postés 20 Statut Membre -  
etbienwi Messages postés 20 Statut Membre -
Bonsoir,
J'ai utilisé Spring Initializr pour générez un squelette de projet spring dans le but de faire une application web pour une liste de tâches.
Le projet s'appel spring-todo mais quand je le lance en utilisant : mvn spring-todo:run , j'ai cette erreur qui apparaît:

No plugin found for prefix 'spring-todo' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\etbienwi\.m2\repository), central (https://repo.maven.apache.org/maven2/>]

J'ai lu le lien d'aide proposé mais je ne sais toujours pas comment réglé le problème.

Merci d'avance.

2 réponses

  1. KX Messages postés 19031 Statut Modérateur 3 020
     
    Bonjour,

    Peu importe comment s'appelle ton projet, le nom du plugin Maven qui démarre l'application s’appellera toujours de la même manière, il faut utiliser la commande
    mvn spring-boot:run
    (pas spring-todo...)
    0
  2. etbienwi Messages postés 20 Statut Membre
     
    Bonjour,
    Je l'ai relancé et maintenant j'ai cette erreur:
     Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.9.RELEASE:run (default-cli) on project spring-todo: An exception occurred while running. null: InvocationTargetException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class:com.mysql.cj.jdbc.Driver


    Voici mon Pom.xml:

    <name>spring-todo</name>

    <description>Application de-gestion de tache</description>

    <parent><groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.9.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
    </parent>

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

    <dependencies>
    <!https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
    <dependency>

    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</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>

    <!-- JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) -->
    <dependency> <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

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

    </dependencies>

    <build>
    <plugins>
    <plugin> <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <executions>
    <execution>
    <goals> <goal>repackage</goal>
    </goals>
    </execution>
    </executions>
    </plugin>
    </plugins>
    </build>
    </project>


    Et voici mon application.properties:

    server.port=8585
    spring.jpa.hibernate.ddl-auto=none
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
    spring.datasource.url=jdbc:mysql://db_mysql:3306/gestiontache
    spring.datasource.username=springtodo
    spring.datasource.password=uvsq
    0
    1. KX Messages postés 19031 Statut Modérateur 3 020
       
      java.lang.IllegalStateException: Cannot load driver class:com.mysql.cj.jdbc.Driver

      Normalement la classe du Driver devrait être com.mysql.jdbc.Driver, il faudrait modifier ton fichier .properties et la valeur de spring.datasource.driver-class-name
      0
    2. etbienwi Messages postés 20 Statut Membre
       
      Merci,
      Je l'ai modifié et il fallait que j'ajoute aussi
      spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect

      Maintenant tout fonctionne.
      0