-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Caused by: java.io.IOException: Found 2 files that match #2104
Comments
Hi @wind57 Thanks for creating this issue. I was not aware of the --file parameter. We will add this to the list of issues to process. What command were you executing when you provided this parameter so that we can recreate the issue. |
I have to make a correction first, terrible sorry. this is what I was trying, against cassandra:
|
Using Liquibase 4.9.1. in <plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<configuration>
<changeLogDirectory>/target/classes</changeLogDirectory>
<propertyFile>/src/main/resources/liquibase.properties</propertyFile>
</configuration>
<executions>
<execution>
<id>user-schema-database-update</id>
<phase>process-resources</phase>
<configuration>
<changeLogDirectory>/src/main/resources</changeLogDirectory>
<username>${username}</username>
<password>${password}</password>
<changeLogFile>/std/master.xml</changeLogFile>
<propertyFileWillOverride>false</propertyFileWillOverride>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
<outputDefaultSchema>false</outputDefaultSchema>
<verbose>true</verbose>
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> Although I explicitly configure
If I remove or comment out <changeLogDirectory>src/main/resources</changeLogDirectory> the error is worse:
The last line is very confusing. Adding <classpath>/target/classes</classpath> I still get the error about 2 conflicting matching files outlined at the top. How do I resolve this ? |
@catull We are doing some discovery regarding how to clarify some of the classpath related errors and confusion. While we work on that though, I wanted to make sure you were able to resolve your immediate issue. Were you? Thanks! |
Hello @kataggart . I was facing same error as OP. I need some scripts to execute every day. I was using default image (4.4.3) with files (changelog and sql folder) mounted by Kubernetes. The yaml definition: ---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: sigep-jobs-cronjob
# annotations:
# argocd.argoproj.io/hook: Sync
spec:
concurrencyPolicy: Replace
# horario UTC
schedule: '5 5 * * *'
jobTemplate:
spec:
template:
spec:
nodeSelector:
app: "true"
containers:
- name: sigep-jobs
image: registry.trt12.jus.br/liquibase/liquibase:4.4.3
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: autoatendimento-comum-config
- secretRef:
name: folhaweb-secret
args: [
"--logLevel=INFO",
"--url=$(ENV_DB_CONNECTIONSTRING)",
"--username=$(BANCO_USUARIO_SRH2)",
"--password=$(BANCO_SENHA_SRH2)",
"update"
]
volumeMounts:
- name: sigep-jobs-config-vol
mountPath: /liquibase/liquibase.docker.properties
readOnly: true
subPath: liquibase.docker.properties
- name: sigep-jobs-config-vol
mountPath: /liquibase/changelog.yaml
readOnly: true
subPath: changelog.yaml
- name: sigep-jobs-sql-vol
mountPath: /liquibase/trt12/sql
readOnly: true
restartPolicy: OnFailure
volumes:
- name: sigep-jobs-config-vol
configMap:
defaultMode: 420
name: sigep-jobs-liquibase-config
- name: sigep-jobs-sql-vol
configMap:
defaultMode: 420
name: sigep-jobs-sql-config
backoffLimit: 4 My SQL file has the following header (I tried logicalFilePath with no luck): --liquibase formatted sql logicalFilePath:trt12/sql/update_logins_vazios.sql
--changeset amandio:DML_UPDATE_LOGINS_VAZIOS stripComments:true splitStatements:true runAlways:true changelog.yaml: databaseChangeLog:
- logical-file-path: trt12/sql
- includeAll:
path: trt12/sql
author: trt12
relativeToChangelogFile: true The error I got:
After many many tries, I built a custom docker image (based on the same liquibase 4.4.3 image) with all my scripts inside it . Et voilá. it works just fine:
I think liquibase is creating and reading aditional files (inside ..data and ..2022_06_03_18_23_02.036673803/ folders) when we use files from outside the image. I hope it helps in your investigation. For me, the best would be not need to create a new image for every script. But, for now, it is the only way it works. PS: We are running Liquibase against an Oracle 19c database. But, I think this is not related with any database. |
Yes it is. The comment #2818 (comment) applies to this one as well and both #3006 and #2917 as possible options for addressing this. |
Dear @kataggart and @nvoxland , Thanks for your solution. But I think it is strange in my case (see my comment above), because I use default liquibase docker image and inject the scripts via volume mount. There are no duplicated files in jar or anywhere else. |
Yes, @antoniolucasnobar I think the setup is something unique to the docker, so it would be nice to split that off into a separate issue we can look at. We are wrapping up the 4.13.0 release which includes some improved logging in addition to the PRs mentioned above. Could you try your setup with the new release when it's available in docker and create an issue describing it and including the new log output? |
Closing this since the original issue is asking about the expected behavior of "if a path matches multiple files in the search-path, we fail with an error". The fix for that is to update your searchpath to not include duplicate files, or to use the |
When I try to execute:
I get:
I can see that there are two files indeed in that directory:
liquibase-changelog-file
, but I did specify exactly the file to use?The text was updated successfully, but these errors were encountered: