IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Web Java Discussion :

Comment désinstaller Flyway d'un projet Spring Maven?


Sujet :

Spring Web Java

  1. #1
    Membre régulier
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2011
    Messages
    248
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2011
    Messages : 248
    Points : 74
    Points
    74
    Par défaut Comment désinstaller Flyway d'un projet Spring Maven?
    Bonjour à tous.


    Je débute complètment en web et j'essaye d'utiliser les dernières technologies du web (docker compose, api 100% restful...)

    Je suis sur un projet d'API spring restful avec docker-compose et plusieurs services:
    - mon API meetzicker(image créée automatiquement via Maven à partir du pom.xml et récupérée lors de l'appel docker-compose up)
    - db (bdd postgres)
    - pgadmin
    - je vais aussi ajouter flyway + tard en service mais pour l'instant je veux le supprimer de mon api sur le host, et je ne sais pas comment m'en débarrasser, 3 jours que je suis bloqué.


    Code yaml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    # meetzicker/docker-compose.yml
    version: "3.3"
    services:
     
      db:
        image: postgres:${POSTGRES_VERSION}
        container_name: db
        network_mode: bridge
        volumes:
          - db-data:/var/lib/postgresql/data
        expose:
          - 5432
        ports:
          - 5432:5432
        environment:
          - POSTGRES_DB=${POSTGRES_DB}
          - POSTGRES_USER=${POSTGRES_USER}
          - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
        restart: unless-stopped
     
     
     
      pgadmin:
        image: dpage/pgadmin4
        network_mode: bridge
        container_name: pgadmin4
        volumes:
          - pgadmin-data:/var/lib/pgadmin
        expose:
          - 5050
        ports:
          - 5051:5050
        links:
          - db:pgsql-server
        environment:
          PGADMIN_DEFAULT_EMAIL: praline40@hotmail.fr
          PGADMIN_DEFAULT_PASSWORD: ${POSTGRES_PASSWORD}
          PGADMIN_PORT: 5050
        restart: unless-stopped
     
      meetzicker:
        image: meetzicker
        network_mode: bridge
        container_name: meetzicker
        volumes:
          - meetzicker-data:/var/lib/meetzicker
        expose:
          - 8080
        ports:
          - 8080:8080
        restart: unless-stopped
        depends_on:
          - db
     
     
    volumes:
      db-data:
      pgadmin-data:
      meetzicker-data:

    Mon fichier pom.xml ==>> autogénération de l'image de mon API lors de l'appel :

    mvn clean install -DskipTests=true


    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    <?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.3.4.RELEASE</version>
    		<relativePath/> <!-- lookup parent from repository -->
    	</parent>
    	<groupId>com.praline40</groupId>
    	<artifactId>meetzicker</artifactId>
    	<version>0.0.1-SNAPSHOT</version>
    	<packaging>jar</packaging>
    	<name>${project.artifactId}</name>
    	<description>MeetZicker REST API</description>
     
    	<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-web</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-data-jpa</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.hibernate.validator</groupId>
    			<artifactId>hibernate-validator</artifactId>
    			<version>6.0.18.Final</version>
    		</dependency>
     
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-validation</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-hateoas</artifactId>
    		</dependency>
     
    		<dependency>
    			<groupId>org.postgresql</groupId>
    			<artifactId>postgresql</artifactId>
    			<scope>runtime</scope>
    		</dependency>
     
    		<dependency>
    			<groupId>org.springframework.boot</groupId>
    			<artifactId>spring-boot-starter-test</artifactId>
    			<scope>test</scope>
    			<exclusions>
    				<exclusion>
    					<groupId>org.junit.vintage</groupId>
    					<artifactId>junit-vintage-engine</artifactId>
    				</exclusion>
    			</exclusions>
    		</dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
            </dependency>
    		<dependency>
    			<groupId>javax.validation</groupId>
    			<artifactId>validation-api</artifactId>
    			<version> 2.0.1.Final </version>
    		</dependency>
    	</dependencies>
     
     
     
     
    	<build>
    		<finalName>${project.artifactId}</finalName>
    		<plugins>
    			<plugin>
    				<groupId>org.springframework.boot</groupId>
    				<artifactId>spring-boot-maven-plugin</artifactId>
    			</plugin>
    			<plugin>
    				<groupId>io.fabric8</groupId>
    				<artifactId>docker-maven-plugin</artifactId>
    				<version>0.20.1</version>
    				<configuration>
    					<images>
    						<image>
    							<name>${project.artifactId}</name>
    							<build>
    								<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
    								<assembly>
    									<mode>dir</mode>
    									<targetDir>/var/lib/${project.artifactId}</targetDir>
    									<descriptor>${project.basedir}/src/main/docker/assembly.xml</descriptor>
    								</assembly>
    							</build>
    						</image>
    					</images>
    				</configuration>
    				<executions>
    					<execution>
    						<id>build</id>
    						<phase>install</phase>
    						<goals>
    							<goal>build</goal>
    						</goals>
    					</execution>
    				</executions>
    			</plugin>
    		</plugins>
    	</build>
     
     
    </project>

    Sinon voilà un aperçu de mon application:


    Nom : Screenshot from 2021-04-25 16-57-32.png
Affichages : 369
Taille : 81,1 Ko

    Lors du docker-compose up, voici l'erreur que j'obtiens sur le lancement de l'image de mon API:

    Code x : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    meetzicker exited with code 1
    meetzicker    | wait-for-it.sh: waiting 15 seconds for db:5432
    meetzicker    | wait-for-it.sh: timeout occurred after waiting 15 seconds for db:5432
    meetzicker    | 
    meetzicker    |   .   ____          _            __ _ _
    meetzicker    |  /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    meetzicker    | ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    meetzicker    |  \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    meetzicker    |   '  |____| .__|_| |_|_| |_\__, | / / / /
    meetzicker    |  =========|_|==============|___/=/_/_/_/
    meetzicker    |  :: Spring Boot ::        (v2.3.4.RELEASE)
    meetzicker    | 
    meetzicker    | 2021-04-25 14:53:40.815  INFO 42 --- [           main] c.p.MeetZicker.MeetZickerApplication     : Starting MeetZickerApplication v0.0.1-SNAPSHOT on 42374ffcaa05 with PID 42 (/var/lib/meetzicker/meetzicker.jar started by root in /var/lib/meetzicker)
    meetzicker    | 2021-04-25 14:53:40.816  INFO 42 --- [           main] c.p.MeetZicker.MeetZickerApplication     : The following profiles are active: dev
    meetzicker    | 2021-04-25 14:53:41.268  INFO 42 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
    meetzicker    | 2021-04-25 14:53:41.337  INFO 42 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 62ms. Found 12 JPA repository interfaces.
    meetzicker    | 2021-04-25 14:53:41.741  INFO 42 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
    meetzicker    | 2021-04-25 14:53:41.749  INFO 42 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
    meetzicker    | 2021-04-25 14:53:41.749  INFO 42 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.38]
    meetzicker    | 2021-04-25 14:53:41.786  INFO 42 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    meetzicker    | 2021-04-25 14:53:41.786  INFO 42 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 939 ms
    meetzicker    | 2021-04-25 14:53:41.877  WARN 42 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Unsatisfied dependency expressed through method 'flywayInitializer' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flyway' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.flywaydb.core.Flyway]: Factory method 'flyway' threw exception; nested exception is org.springframework.boot.autoconfigure.flyway.FlywayMigrationScriptMissingException: Cannot find migration scripts in: [classpath:db/migration] (please add migration scripts or check your Flyway configuration)
    meetzicker    | 2021-04-25 14:53:41.878  INFO 42 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
    meetzicker    | 2021-04-25 14:53:41.885  INFO 42 --- [           main] ConditionEvaluationReportLoggingListener : 
    meetzicker    | 
    meetzicker    | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    meetzicker    | 2021-04-25 14:53:41.886 ERROR 42 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 
    meetzicker    | 
    meetzicker    | ***************************
    meetzicker    | APPLICATION FAILED TO START
    meetzicker    | ***************************
    meetzicker    | 
    meetzicker    | Description:
    meetzicker    | 
    meetzicker    | Flyway failed to initialize: none of the following migration scripts locations could be found:
    meetzicker    | 
    meetzicker    |         - classpath:db/migration
    meetzicker    | 
    meetzicker    | 
    meetzicker    | Action:
    meetzicker    | 
    meetzicker    | Review the locations above or check your Flyway configuration
    meetzicker    | 
    meetzicker exited with code 1



    Bref la question est simple ! tout est dans le titre: je souhaite me débarrasser de Flyway dans mon api.
    "Les ordinateurs font toujours ce qu'on leur dit, mais jamais ce qu'on veut."

  2. #2
    Membre régulier
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2011
    Messages
    248
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2011
    Messages : 248
    Points : 74
    Points
    74
    Par défaut
    J'ai tout essayé, impossible de m'en débarraser...

    J'ai meme mis spring.flyway.enabled=false dans la config...

    Rien à faire...
    "Les ordinateurs font toujours ce qu'on leur dit, mais jamais ce qu'on veut."

  3. #3
    Membre régulier
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2011
    Messages
    248
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2011
    Messages : 248
    Points : 74
    Points
    74
    Par défaut
    Personne n'a une idée ? Je pense que ma question est plus globale et consiste à supprimer des dépendances persistantes.
    "Les ordinateurs font toujours ce qu'on leur dit, mais jamais ce qu'on veut."

  4. #4
    Membre régulier
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2011
    Messages
    248
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2011
    Messages : 248
    Points : 74
    Points
    74
    Par défaut
    J'ai suivi ce tutoriel mais c'est toujours pas résolu :

    alcoforado, Idea works in another way: it use one-way sync from pom to *iml but not vice-versa. So add your dependency to pom and reimport this pom (in Meven toolwindow) - record will be automatically added to iml. . But it seems idea does not remove old entries from iml (when you removed them from pom). So to make 'full' sync: 1. Open Project Structure-> Modules -> dependencies, remove all Maven entries. 2. Close window, Maven > clean then reimport maven project. Then Main menu -> Build-> rebuild project. – kool79 Oct 17 '18 at 23:55

    Apparemment je dois appeler Flyway quelque part dans mon code, mais je ne sais pas où !!! Impossible de trouver même par une recherche globale....

    Je deviens fou ça fait un mois que je suis bloqué la dessus.....
    "Les ordinateurs font toujours ce qu'on leur dit, mais jamais ce qu'on veut."

  5. #5
    Membre régulier
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2011
    Messages
    248
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2011
    Messages : 248
    Points : 74
    Points
    74
    Par défaut
    J'utilise Fabric8 pour contruire l'image de mon API.

    Est'ce que Flyway ne serait pas inclu dedans ?
    "Les ordinateurs font toujours ce qu'on leur dit, mais jamais ce qu'on veut."

  6. #6
    Membre régulier
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2011
    Messages
    248
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2011
    Messages : 248
    Points : 74
    Points
    74
    Par défaut
    J'ai posté mon projet sur GitHub, il est public!


    https://github.com/praline40/MeetZickerAPI
    "Les ordinateurs font toujours ce qu'on leur dit, mais jamais ce qu'on veut."

  7. #7
    Membre régulier
    Homme Profil pro
    Ingénieur intégration
    Inscrit en
    Juin 2011
    Messages
    248
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur intégration
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2011
    Messages : 248
    Points : 74
    Points
    74
    Par défaut
    Problème résolu, il s'agissait d'une mauvaise gestion des volumes.

    J'ai allégé mon fichier docker-compose :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
     
    version: '2'
    services:
      meetzicker:
        image: meetzicker
        ports:
          - "8080:8080"
        depends_on:
          - db
     
      db:
        image: postgres:${POSTGRES_VERSION}
        ports:
          - "5432:5432"
        environment:
          - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
          - POSTGRES_USER=${POSTGRES_USER}
          - POSTGRES_DB=${POSTGRES_DB}
    Je n'ai plus cette erreur.
    "Les ordinateurs font toujours ce qu'on leur dit, mais jamais ce qu'on veut."

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème de création d'un projet Spring , Maven
    Par cürüs dans le forum Spring
    Réponses: 1
    Dernier message: 22/11/2015, 15h19
  2. [GWT + Maven]Comment debugger un projet sous Maven
    Par PhilippeGibault dans le forum GWT et Vaadin
    Réponses: 2
    Dernier message: 08/02/2012, 16h23
  3. Réponses: 2
    Dernier message: 07/10/2011, 15h55
  4. Réponses: 0
    Dernier message: 23/07/2009, 17h19
  5. Réponses: 2
    Dernier message: 02/04/2009, 16h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo