Using a Parent POM

We have been successfully using Liquibase 2.0 RC2 for the past few months on our project. Now we have come to a stage where it makes sense to split our project into a core and several web applications. We want the Liquibase Maven Plugin to run for each module, so we left the plugin configuration in the parent POM unchanged. However, now the plugin complains that it cannot find the properties file. It is as if the classpath does not include src/main/resources anymore. If we explicitly give the path to the properties file, e.g. src/main/resources/liquibase.properties, it is found, but then it cannot find the change log file. If we prepend src/main/resources/ to the change log file path, it is found, but then the migration files cannot be found. All these files were specified relative to src/main/resources before and it worked flawlessly. Do you have any suggestions?

      org.liquibase   liquibase-maven-plugin   2.0-rc2-SNAPSHOT             process-resources               jdbc.properties         false                     update            
    [INFO] [liquibase:update {execution: default}] [INFO] ------------------------------------------------------------------------ [INFO] Parsing Liquibase Properties File [INFO]  File: liquibase.properties [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve the properties file. [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.BuildFailureException: Failed to resolve the properties file. at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:715) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138) at org.apache.maven.cli.MavenCli.main(MavenCli.java:362) at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60) 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.MojoFailureException: Failed to resolve the properties file. at org.liquibase.maven.plugins.AbstractLiquibaseMojo.configureFieldsAndValues(AbstractLiquibaseMojo.java:323) at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:218) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694) ... 17 more

Hi, I’m using parent POM

do copy all the files to the target/classes directory and use it as base dir.

in my case parent POM section:

    src/main/liquibase ${basedir}/src/main/liquibase **/*.xml **/*.sql **/*.csv ...

this trick make all liquibase-related files accessible at maven runtime.

Cheers, Oleg

Hi @taranenko,

I did not understand your solution. Are you saying to copy all the liquibase.properties files and changelogs into the target/classes folder?

Thanks!

Ronak