Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

includeAll not working with Liquibase 4.0.0 #1436

Closed
jglink opened this issue Sep 28, 2020 · 18 comments · Fixed by #1665 or #1688
Closed

includeAll not working with Liquibase 4.0.0 #1436

jglink opened this issue Sep 28, 2020 · 18 comments · Fixed by #1665 or #1688
Assignees
Labels
DBAll hacktoberfest a month-long celebration of open-source software and Developers contribute by completing PRs ImpactMedium IntegrationCLI PRAssociated Severity3 TypeBug

Comments

@jglink
Copy link

jglink commented Sep 28, 2020

Starting with Liquibase 4.0.0, the includeAll definition in a change log file doesn´t work anymore if the referenced files are placed in a JAR file.
It´s working fine, if the files can be referenced from a target folder during development but not when the changesets should be accessed from JAR.

For details, see also https://forum.liquibase.org/t/includeall-with-v4-0-0/4655
Text from forum update
With the Quarkus version 1.7.1 which uses Liquibase 3.9.x everything works fine.

But Quarkus 1.8.x upgrades to Liquibase 4.0.0 and this causes issues with change sets using the includeAll tag.

Our changeLog.xml contains following:

When we start the application in the Quarkus dev mode (mvn quarkus:dev) everything works fine; the changeLog is read and every file under the given path (db/1.0.0/) is executed/checked from Liquibase.

But if we run the application directly (with java -jar) we are getting following error:

Caused by: liquibase.exception.SetupException: Could not find directory or directory was empty for includeAll 'db/1.0.0/'
	at liquibase.changelog.DatabaseChangeLog.includeAll(DatabaseChangeLog.java:528)

The resources under this given folder are just not found.

If I define the includes per file, it´s working fine:

How can we define the includeAll tags with the new Liquibase 4.0.0 version?

@ro-rah ro-rah added the hacktoberfest a month-long celebration of open-source software and Developers contribute by completing PRs label Sep 28, 2020
@ro-rah
Copy link

ro-rah commented Sep 30, 2020

@nvoxland, @mariochampion and @molivasdat, is this change in behavior intentional from 3.x to 4.x?

@molivasdat
Copy link
Contributor

@ro-rah This change is not intentional.
@jglink Thanks for writing up this issue. We will add it to our list of issues to process. This may be a duplicate of the fat jar issue. I'll find the issue number.

@jglink
Copy link
Author

jglink commented Nov 3, 2020

Any news about this issue?
Is there a plan, when this error will be fixed and a new version released?
Thanks.

@molivasdat
Copy link
Contributor

Hi @jglink . Have you tried this with v4.1.1? There was a change to the Resource Accessor class in how files are searched and loaded.

@jglink
Copy link
Author

jglink commented Nov 3, 2020

No, I haven´t checked 4.1.1 - was not aware, that a new version was already published.
I will give it a try and report the results.

@jglink
Copy link
Author

jglink commented Nov 12, 2020

@molivasdat Sorry, it took some time until I had the chance to look at it again.
Yes, the includeAll is working again with Liquibase 4.1.1
Thanks

@molivasdat
Copy link
Contributor

Hi @jglink Thanks for the feedback.

@acierto
Copy link

acierto commented Nov 18, 2020

Not completely.
Still doesn't work on Windows 2008 R2 (JDK 8).
Or completely doesn't work on JDK 11.

Tested on liquibase 4.2.0

@molivasdat
Copy link
Contributor

Hi @acierto
Thanks for the feedback on this.
Windows 2008 R2 is no longer supported.
https://support.microsoft.com/en-us/help/4456235/end-of-support-for-windows-server-2008-and-windows-server-2008-r2
I'll take a look at the JRE11.

@mmdl
Copy link

mmdl commented Dec 2, 2020

@molivasdat Sorry, it took some time until I had the chance to look at it again.
Yes, the includeAll is working again with Liquibase 4.1.1
Thanks

For me not working on JDK 11. Also not working with v4.2.0.
@jglink can you paste your example code.

@jglink
Copy link
Author

jglink commented Dec 3, 2020

I´m using Liquibase from within Quarkus (updated the dependency manually because Quarkus 1.9.x still used Liquibase 4.0).
And it´s working fine with JDK 11 (Amazon Corretto) and Liquibase 4.1.1

The definition of the import in a changeLog.xml looked like this:
<includeAll path="db/1.0.0" errorIfMissingOrEmpty="true"/>

@igorrs
Copy link

igorrs commented Jan 30, 2021

Same problem here with version 4.2.2 on JDK 14.

@famod
Copy link
Contributor

famod commented Feb 2, 2021

So what happens in conjunction with Quarkus is that this returns an empty String: https://github.com/liquibase/liquibase/blob/v4.2.2/liquibase-core/src/main/java/liquibase/resource/ClassLoaderResourceAccessor.java#L236
I don't think Quarkus has anything to do with it. Instead, it seems like the wrong way to get a directory listing from within a jarfile, e.g.:

jar:file:/home/foobar/lq-includeall/target/lq-includeall-1.0.0-SNAPSHOT-runner.jar!/db/1.0.0/

(this is basically the same what has already been discussed in the forum topic that is liked in the issue description)

There is also a Quarkus reproducer here: quarkusio/quarkus#14751
To debug, just run:

  • mvn clean package -DskipTests
  • java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000 -jar target/lq-includeall-1.0.0-SNAPSHOT-runner.jar

@jglink
Copy link
Author

jglink commented Feb 3, 2021

As already mentioned /linked on the Quarkus forum: the includeAll option worked for me with Quarkus 1.10.x which used Liquibase 4.1.1 but not anymore with updated Quarkus 1.11.x using Liquibase 4.2.2

@sync-by-unito
Copy link

sync-by-unito bot commented Feb 3, 2021

➤ Nathan Voxland commented:

PR #1665 should fix this.

@nvoxland
Copy link
Contributor

nvoxland commented Feb 9, 2021

In testing #1665, we found that the specific error you were seeing was different than the error we had reproduced and fixed.

I was able to reproduce the reported Could not find directory or directory was empty for includeAll error with Liquibase 4.0.0 but it either went away or matched the error that was fixed in #1665 depending on my setup. So, I'm not sure if the original error is still around in 4.2.2 and I'm just not correctly reproducing it, or if the original issue was solved and you moved on to new problems.

I'll see if I can reproduce it using the steps in quarkusio/quarkus#14751 to better understand what is going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DBAll hacktoberfest a month-long celebration of open-source software and Developers contribute by completing PRs ImpactMedium IntegrationCLI PRAssociated Severity3 TypeBug
Projects
None yet
10 participants