Closed jozefmorvay closed 5 years ago
I'll keep an eye out for the next release to see if CORE-3343 gets resolved.
In the meantime, if the issue is truly fixed in the master branch, there are a couple of workarounds you could try...
Option 1:
If you're the only one building your project, you can simply clone the master branch and run mvn -DskipTests install
to install the latest Liquibase to your local maven "repository"
Add mavenLocal()
to your build.gradle in all the places that currently have mavenCentral()
, making sure that mavenLocal comes before mavenCentral()
Change the liquibaseRuntime
Liquibase dependency to whatever version is in the Liquibase pom.xml.
Option 2:
If more than one person is building your project, you'll need to do the same things as option 1, but with an extra step to upload your version of Liquibase to a shared repository. That repository would then need to be added to build.gradle, but instead of mavenLocal()
, you'd have maven { url "http://myhost.mycompany.com/repo" }
I am building it alone, so option 1 it is. Your suggested solution appears to have work, the URI exception is now gone. It still doesn't work ,though:
Unexpected error running Liquibase: java.lang.NullPointerException
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at liquibase.integration.commandline.CommandLineUtils.doDiff(CommandLineUtils.java:200)
at liquibase.integration.commandline.Main.doMigration(Main.java:1004)
at liquibase.integration.commandline.Main.lambda$run$0(Main.java:187)
at liquibase.Scope.child(Scope.java:125)
at liquibase.Scope.child(Scope.java:106)
at liquibase.Scope.child(Scope.java:138)
at liquibase.Scope.child(Scope.java:142)
at liquibase.integration.commandline.Main.run(Main.java:186)
at liquibase.integration.commandline.Main.main(Main.java:125)
Caused by: liquibase.command.CommandExecutionException: java.lang.NullPointerException
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:24)
at liquibase.integration.commandline.CommandLineUtils.doDiff(CommandLineUtils.java:198)
... 8 common frames omitted
Caused by: java.lang.NullPointerException: null
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.getDatabaseCatalogNames(JdbcSnapshotGenerator.java:147)
at liquibase.snapshot.jvm.CatalogSnapshotGenerator.snapshotObject(CatalogSnapshotGenerator.java:34)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:66)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:286)
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:96)
at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59)
at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:38)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:215)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:188)
at liquibase.command.core.DiffCommand.createReferenceSnapshot(DiffCommand.java:221)
at liquibase.command.core.DiffCommand.createDiffResult(DiffCommand.java:143)
at liquibase.command.core.DiffCommand.run(DiffCommand.java:135)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:19)
... 9 common frames omitted
This is caused by some weird class, which I do not understand the purpose of. It just returns null/0/false for everything. So then I tried removing
referenceDriver 'liquibase.ext.hibernate.database.connection.HibernateDriver'
and replaced the line with:
driver 'org.postgresql.Driver'
But that amounted to getting a new exception instead:
Unexpected error running Liquibase: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:sk.imuna.warehouse.db?dialect=org.hibernate.dialect.PostgreSQL94Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy)
liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:sk.imuna.warehouse.db?dialect=org.hibernate.dialect.PostgreSQL94Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:131)
at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:1407)
at liquibase.integration.commandline.Main.doMigration(Main.java:1005)
at liquibase.integration.commandline.Main.lambda$run$0(Main.java:187)
at liquibase.Scope.child(Scope.java:125)
at liquibase.Scope.child(Scope.java:106)
at liquibase.Scope.child(Scope.java:138)
at liquibase.Scope.child(Scope.java:142)
at liquibase.integration.commandline.Main.run(Main.java:186)
at liquibase.integration.commandline.Main.main(Main.java:125)
Caused by: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:sk.imuna.warehouse.db?dialect=org.hibernate.dialect.PostgreSQL94Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:247)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:142)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:96)
... 9 common frames omitted
Caused by: java.lang.RuntimeException: Cannot find database driver: Driver class was not specified and could not be determined from the url (hibernate:spring:sk.imuna.warehouse.db?dialect=org.hibernate.dialect.PostgreSQL94Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy)
at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:193)
... 11 common frames omitted
No idea what that means since postgre driver is clearly listed as a liquibaseRuntime dependency, and I have seen other liquibase configurations that looked just like mine and worked.
Anyway, this is just me ranting, your suggestion was helpful. The follow up problems are not related to this issue, or the plugin in general.
The issue got resolved in Liquibase 3.6.3. You can find a working example in my repo. You just have to use the following:
liquibaseRuntime 'org.liquibase:liquibase-core:3.6.3'
@Kr0oked very cool. it works now.
Hello. As instructed in #44 , I am opening a new issue here. Not sure if this a proper issue, and as was discussed in the other thread, this most likely is not even fault of LB gradle plugin. Anyway, I will appreciate any help or advice on how I could proceed with this without resorting to Java 8 (which I haven't tried yet, but it should supposedly work).
So, I am trying to generate liquibase changelog based on changed JPA entities. My build.gradle looks like this:
A log from running gradle task in intellij:
Now, a little bit of reading revealed that the fix for this is already merged in the PR https://github.com/liquibase/liquibase/pull/830, but the newest release on maven central is 3.6.2 from 4th July 2018, so the fix remains in master for now. So I tried to include a github repo dependency through jitpack - commented out lines in the build file - but I can't get it to work.
My question is, what options do I have to solve this for now? #44 mentions adding javax.xml.bind:jaxb-api as liquibaseRuntime dependency, so I did that:
liquibaseRuntime("javax.xml.bind:jaxb-api:2.3.1")
But the same thing happens. What steps could I take to properly troubleshoot this? I am not very knowledgeable about how Gradle and its plugins work.