Hello there:
I’ve been happily using liquibase with Maven for quite a while now, but started observing some problems as soon as I enabled cobertura report generation.
I have a single-module Maven project. In my pom.xml, I have liquibase configured as follows:
-
org.liquibase
liquibase-plugin
1.9.3.0
production-db
process-resources
src/main/resources/liquibase.properties
update
test-db
test-compile
src/test/resources/liquibase.properties
update
Under the directory src/main/resources I have the file �liquibase.properties� with the following contents:
- username=dev
password=dev
url=jdbc:mysql://localhost/prod_db
driver=com.mysql.jdbc.Driver
changeLogFile=dbChangeLog.xml
Also, under the same directory (src/main/resources) I have my dbChangeLog.xml file.
I have a similar setting for my test database: under src/test/resources I have a liquibase.properties file with the same contents as the one shown above (except that the database is �test_db� instead of �prod_db�).
Everything works really well whenever I run a regular build:
mvn clean install
Both of my databases are updated as expected; I can see from the logs that liquibase is finding the dbChangeLog.xml for both update executions, as specified in the pom.xml.
Now, I want to generate reports for my build, so I added the following section at the end of my pom.xml:
-
org.codehaus.mojo
cobertura-maven-plugin
Running a regular build still works as before, however, if a run a site build (to trigger report generation):
mvn clean install site
I see liquibase executing successfully on the first pass of the build, but fails on the second pass with the error:
[INFO] Executing on Database: jdbc:mysql://localhost/prod_db
2-Jun-2009 10:10:41 AM liquibase.database.template.JdbcTemplate comment
INFO: Lock Database
2-Jun-2009 10:10:41 AM liquibase.lock.LockHandler acquireLock
INFO: Successfully acquired change log lock
2-Jun-2009 10:10:41 AM liquibase.database.template.JdbcTemplate comment
INFO: Release Database Lock
2-Jun-2009 10:10:41 AM liquibase.lock.LockHandler releaseLock
INFO: Successfully released change log lock
2-Jun-2009 10:10:41 AM liquibase.database.template.JdbcTemplate comment
INFO: Release Database Lock
2-Jun-2009 10:10:41 AM liquibase.lock.LockHandler releaseLock
INFO: Successfully released change log lock
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error setting up or running Liquibase: dbChangeLog.xml does not exist
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error setting up or running Liquibase: dbChangeLog.xml does not exist
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:924)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:767)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:549)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:499)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error setting up or running Liquibase: dbChangeLog.xml does not exist
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:194)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
… 20 more
Caused by: liquibase.exception.ChangeLogParseException: dbChangeLog.xml does not exist
at liquibase.parser.xml.XMLChangeLogParser.parse(XMLChangeLogParser.java:65)
at liquibase.parser.ChangeLogParser.parse(ChangeLogParser.java:28)
at liquibase.Liquibase.update(Liquibase.java:105)
at org.liquibase.maven.plugins.LiquibaseUpdate.doUpdate(LiquibaseUpdate.java:19)
at org.liquibase.maven.plugins.AbstractLiquibaseUpdateMojo.performLiquibaseTask(AbstractLiquibaseUpdateMojo.java:23)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:190)
… 22 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 55 seconds
[INFO] Finished at: Tue Jun 02 10:10:41 EDT 2009
[INFO] Final Memory: 24M/44M
[INFO] ------------------------------------------------------------------------
Why is the liquibase plugin not finding my dbChangeLog.xml when executing a site when it can clearly find it when running a normal build?
Any help will be greatly appreciated.
Thanks in advance.