Reputation: 2599
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>
Upvotes: 9
Views: 28273
Reputation: 437
First of all you are using a phase process-resource, which is basically used when you want to work on your changeLog from the output target directories, and if you are trying to use the filtering in your resource files using maven resource filtering plugin.
And I don't know for what purpose you are actually using the prepare-package or any such phase multiple times, maven with liquibase is not setup like this, you should have one master changelog, which should include your other upgrades, with some preCondition checks in each of your upgrades.
Your directory structure should be something like following, if you want to use your process-resource phase, and intended to do some kind of filtering in resource files.
src/
`-- main
|-- java
`-- resources
|-- changelog-1.0.0.xml
|-- changelog-1.1.0.xml
|-- changelog-install.xml
|-- com
| `-- obolus
| `-- database
| `-- changelog
| |-- v000
| | |-- cst
| | | |-- entity_extra_data.xml
| | | `-- entity.xml
| | |-- master.xml
| | `-- tab
| | |-- company.xml
| | |-- entity_extra_data.xml
| | |-- entity.xml
| | `-- anothertable.xml
| `-- v001
| |-- master.xml
| `-- tab
| `-- sample.xml
|-- lib
| |-- ojdbc6-11.2.0.3.jar
`-- liquibase.properties
Example of POM file
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.obolus</groupId>
<artifactId>database</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.maven.plugin}</version>
<configuration>
<changeLogFile>target/classes/changelog-install.xml</changeLogFile
<propertyFile>target/classes/liquibase.properties</propertyFile>
<logging>${logLevel}</logging>
</configuration>
<executions>
<execution>
<goals>
<goal>status</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<!-- resource filtering -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>${ojdbc.driver.version}</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<ojdbc.driver.version>11.2.0.3</ojdbc.driver.version>
<liquibase.maven.plugin>3.3.2</liquibase.maven.plugin>
<logLevel>severe</logLevel>
</properties>
</project>
Hope that helps.
Upvotes: 0
Reputation: 807
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
Upvotes: 8
Reputation: 5884
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
Upvotes: 1