Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

liquibase plugin errors using maven

Hi i'm new to liquibase , and i'm importing an existing project after compile it i get this build failure , i can't understand the cause and the solution i'm trying to understand the code but i really find problem to do it .

this is the result after running mvn compile

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.squashtest.tm:squashtest-csp-distribution:pom:1.2.0.RELEASE
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: ${project.groupId}:org.squashtest.csp.core.log4j:jar -> duplicate declaration of version ${project.version} @ line 419, column 17
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: ${project.groupId}:org.squashtest.csp.core.jetty.start.osgi:jar -> duplicate declaration of version ${project.version} @ line 424, column 17
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: ${project.groupId}:org.squashtest.csp.core.service:jar -> duplicate declaration of version ${project.version} @ line 450, column 17
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: ${project.groupId}:squashtest-csp-launcher:jar -> duplicate declaration of version ${project.version} @ line 455, column 17
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: ${project.groupId}:org.squashtest.csp.tm.web:war -> duplicate declaration of version ${project.version} @ line 461, column 17
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: ${project.groupId}:org.squashtest.csp.tm.service:jar -> duplicate declaration of version ${project.version} @ line 467, column 17
[WARNING] 'profiles.profile[build-mysql].plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.codehaus.mojo:sql-maven-plugin @ line 682, column 15
[WARNING] 'profiles.profile[build-mysql].plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.liquibase:liquibase-maven-plugin @ line 724, column 15
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building squashtest-tm-distribution 1.2.0.RELEASE
[INFO] ------------------------------------------------------------------------
[WARNING] Failed to retrieve plugin descriptor for org.codehaus.izpack:izpack-maven-plugin:1.0-alpha-5: Plugin org.codehaus.izpack:izpack-maven-plugin:1.0-alpha-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.izpack:izpack-maven-plugin:jar:1.0-alpha-5
[INFO] 
[INFO] --- liquibase-maven-plugin:2.0.1:update (default-cli) @ squashtest-csp-distribution ---
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:12.500s
[INFO] Finished at: Fri Jul 13 10:25:08 GMT+01:00 2012
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:2.0.1:update (default-cli) on project squashtest-csp-distribution: The driver has not been specified either as a parameter or in a properties file. -> [Help 1]**
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Here's the pom.xml liquibase part :

 <!-- We first run a full install against MySQL -->
  <plugin>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-maven-plugin</artifactId>
    <configuration>
      <skip>${mysql.distro.skip}</skip>
    </configuration>
    <executions>
      <execution>
        <id>generate-mysql-full-install-script</id>
        <phase>process-resources</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>true</dropFirst>
          <changeLogFile>${master.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-full-install-

        version-${project.version}.sql</migrationSqlOutputFile>
        </configuration>
      </execution>
    </executions>
  </plugin>

        <!-- We now run an incremental install against MySQL -->
  <plugin>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-maven-plugin</artifactId>
    <configuration>
      <skip>${mysql.distro.skip}</skip>
    </configuration>
    <executions>
      <execution>
        <id>generate-mysql-0.15.0-script</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>true</dropFirst>
          <changeLogFile>${upgrade.0.15.0.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-upgrade-
           to-0.15.0.sql</migrationSqlOutputFile>
        </configuration>
      </execution>

      <execution>
        <id>generate-mysql-0.17.0-script</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>false</dropFirst>
          <changeLogFile>${upgrade.0.17.0.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-upgrade-
           to-0.17.0.sql</migrationSqlOutputFile>
        </configuration>
      </execution>

      <execution>
        <id>generate-mysql-0.20.0-script</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>false</dropFirst>
          <changeLogFile>${upgrade.0.20.0.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-upgrade-
           to-0.20.0.sql</migrationSqlOutputFile>
        </configuration>
      </execution>

      <execution>
        <id>generate-mysql-0.23.0-script</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>false</dropFirst>
          <changeLogFile>${upgrade.0.23.0.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-upgrade-
          to-0.23.0.sql</migrationSqlOutputFile>
        </configuration>
      </execution>

      <execution>
        <id>generate-mysql-1.1.0-script</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>false</dropFirst>
          <changeLogFile>${upgrade.1.1.0.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-upgrade-
           to-1.1.0.sql</migrationSqlOutputFile>
        </configuration>
      </execution>

      <execution>
        <id>generate-mysql-1.1.1-script</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>false</dropFirst>
          <changeLogFile>${upgrade.1.1.1.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-upgrade- 

           to-1.1.1.sql</migrationSqlOutputFile>
        </configuration>
      </execution>
      <execution>
        <id>generate-mysql-1.2.0-script</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>updateSQL</goal>
        </goals>
        <configuration>
          <dropFirst>false</dropFirst>
          <changeLogFile>${upgrade.1.2.0.changelog}</changeLogFile>
          <driver>com.mysql.jdbc.Driver</driver>
          <url>${liquibase.mysql.url}</url>
          <username>${liquibase.mysql.username}</username>
          <password>${liquibase.mysql.password}</password>
          <migrationSqlOutputFile>${database.script.directory}/mysql-upgrade-
          to-${squashTmVersion}.sql</migrationSqlOutputFile>
        </configuration>
      </execution>
    </executions>
   </plugin>
like image 630
Amira Manai Avatar asked Jul 13 '12 09:07

Amira Manai


2 Answers

You receive this error because the value of the url is provided by a maven property, referred as ${liquibase.mysql.url}

You can set the value for maven properties in your pom like:

 <project>
    [...]
    <properties>
      <liquibase.mysql.url>jdbc:mysql://127.0.0.1:3306</liquibase.mysql.url>
      <liquibase.mysql.username>someuser</liquibase.mysql.username>
      [...]
    </properties>
    [...]

The liquibase plugin also provides possibility to read the configuration properties from a property file e.g. src/main/resources/liquibase.properties If you choose this, you need to configure the liquibase maven plugin by replacing the conofiguration section in the pom like:

[...]
 <configuration>
    <propertyFile>src/main/resources/liquibase.properties</propertyFile>
 </configuration>
[...]

Then the liquibase properties should look like

url=jdbc:mysql://127.0.0.1:3306      
username=someuser
dropFirst=true
changeLogFile=yourfile
[...]

More information is here: http://www.liquibase.org/documentation/maven/index.html#using_configuration_property_files

like image 81
pharsfalvi Avatar answered Sep 26 '22 14:09

pharsfalvi


You need to set your variables ${liquabase.mysql.url} and so forth in your .m2/settings.xml. More details here: Missing maven .m2 folder

You also need to run mvn liquibase:update

like image 23
Peter Avatar answered Sep 22 '22 14:09

Peter