-
Notifications
You must be signed in to change notification settings - Fork 60
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
V3.0.1 Invalid argument '--url': missing required argument #160
Comments
Of course I could go back to version 2.2, but 2.2 doesn't seem to support the use of defaultSchemaName in |
Try running with My hunch is that the |
I have similar troubles with my project, strange behavior on activity and arguments. |
My problems are intermittent. Now I'm clueless. For now I've given up on using this plugin for now, pending a newer version. |
I can't reproduce the "diff" behavior. Whenever I run diff, I get the right arguments passed to Liquibase. My hunch is that the intermittent nature of the plugin's behavior is somehow related to the gradle daemon. Perhaps the daemon is holding on to something in the cache that it shouldn't? Does stopping the daemon help at all? |
I try to kill all my gradle demons like discribed in this post: https://stackoverflow.com/questions/69468990/momentarily-kill-or-restart-gradle-daemon-from-inside-intellij-idea-gradle-s But it does not help. Below I describe my testing litle bit more: My config file is as follows: liquibase {
jvmArgs = "-Duser.dir=${project.projectDir}"
val encryptedDBPassword = properties["datasource.password"] as String
activities.register("diff") {
this.arguments = mapOf(
"changelogFile" to "src/main/resources/db/migration/changelogs/${version}_diff_changelog.xml",
"url" to properties["datasource.url"],
"username" to properties["datasource.user"],
"password" to decrypt(encryptedDBPassword),
"defaultSchemaName" to properties["default.schemas"],
"referenceUrl" to "hibernate:spring:com.dls.vwa.robi.server.dataaccess?dialect=org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect&hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy",
"driver" to "org.postgresql.Driver",
"referenceDriver" to "liquibase.ext.hibernate.database.connection.HibernateDriver"
)
}
activities.register("generate-data-changelog") {
this.arguments = mapOf(
"liquibaseOutputFile" to "src/main/resources/db/migration/changelogs/_changelog_data.xml",
"url" to properties["datasource.url"],
"username" to properties["datasource.user"],
"password" to decrypt(encryptedDBPassword),
"defaultSchemaName" to properties["default.schemas"],
"diffTypes" to "data"
)
}
activities.register("generate-changelog") {
this.arguments = mapOf(
"liquibaseOutputFile" to "src/main/resources/db/migration/changelogs/_changelog.xml",
"url" to properties["datasource.url"],
"username" to properties["datasource.user"],
"password" to decrypt(encryptedDBPassword),
"defaultSchemaName" to properties["default.schemas"],
)
}
activities.register("dropAll") {
this.arguments = mapOf(
"url" to properties["datasource.url"],
"username" to properties["datasource.user"],
"password" to decrypt(encryptedDBPassword),
"defaultSchemaName" to properties["default.schemas"],
)
}
} I start gradle task "diff" from IntelliJ in "Debug Mode". I set two breakpoints one in ArgumentBuilder.groovy and the other one on LiquibaseTask.groovy and debug the plugin. Why is wrong liquibase activity running? I don't know is this a problem of IntelliJ or Gradle or of plugin them self. The next try from me, was to use only one activity, my config like so: liquibase {
jvmArgs = "-Duser.dir=${project.projectDir}"
val encryptedDBPassword = properties["datasource.password"] as String
activities.register("diff") {
this.arguments = mapOf(
"changelogFile" to "src/main/resources/db/migration/changelogs/${version}_diff_changelog.xml",
"url" to properties["datasource.url"],
"username" to properties["datasource.user"],
"password" to decrypt(encryptedDBPassword),
"defaultSchemaName" to properties["default.schemas"],
"referenceUrl" to "hibernate:spring:com.dls.vwa.robi.server.dataaccess?dialect=org.hibernate.spatial.dialect.postgis.PostgisPG95Dialect&hibernate.physical_naming_strategy=org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy",
"driver" to "org.postgresql.Driver",
"referenceDriver" to "liquibase.ext.hibernate.database.connection.HibernateDriver"
)
}
} The right activity runs. The plugin works and create liquibase command to execute diff, but it is without "--changelog-file" parameter configuration I get following debug outprint: But where is the changelogFile configuration, it was configured for the running activity. |
I think I see where some of the confusion may be coming from. There is a difference between a Liquibase "command" and a plugin Activity. A command is a liquibase command, such as Activities are introduced by the plugin. An activity is a more high level, broad category, and can be used to run the same command in different ways. For example, deploying an application might involve updating the application's schema, but it might also involve inserting metadata about the application in a registry in a different database. The plugin achieves this by allowing users to define 2 activities, each referring to different databases and changelogs. Activities can also be thought of as a collection of parameters that need to be grouped together. Perhaps "configuration" or "paramCollection" would have been a better choice... The I usually put the following in my build.gradle files: if ( !project.hasProperty("runList") ) {
project.ext.runList = "main"
} Then I define a "main" activity with all the parameters I need for running Liquibase commands. The plugin only supplies parameters to the liquibase command that are actually supported by the command. So in this case, the referenceUrl would be sent with "diff", but not "dropAll", no need to have 2 activities. That setup makes "main" the default activity. If I wanted to have more than one activity, I could specify which one to use at runtime by including |
After you explanation comment, I changed my configuration to:
NORMAL RUN If I start gradle job normal Run -> diff, i get error:
This is strange error: DEBUG RUN Start gradle job debug Run -> diff. I get completely differen result! Diff runs: And i can't debug the plugin from IntelliJ, because Some idea to next try? |
The LiquibaseTask class extends JavaExec, so you have to debug it a little differently. I'm not very familliar with Kotlin files, so I'm not sure why you get the behavior you do. I generally start with the I also downloaded the Liquibase standalone CLI, where I can run I hope this helps. |
I add println to my gradle.build.kts to outprint my map with key=value
Output:
In debug(--debug) console output: Gradle makes strange things? (class -> org.gradle.internal.execution.steps.SkipUpToDateStep)
This is wrong, all this arguments are supported by diff command... At the end, I get java errors:
I'm not sure, but is this a gradle problem? |
I also have this strange error happening intermittently in my project. But my rollback from v3 to v2 doesn't seem to create such a problem. |
When the plugin applies, it uses a Liquibase API to get the supported arguments for each command. When that API call returns empty lists, we get the behavior you see, where all the arguments are rejected as "unsupported". I have no idea why this API call returns empty lists sometimes, only that it never does when I use the debugger. I did notice that the classpath seems to have an impact. For example, the plugin used to load the tasks at apply time, but get the supported arguments at execute time. What eventually realized is that apply time and execute time is two different classpaths, and while the same version of liquibase was used in both the My hunch is that it is that something similar happens with the Gradle Daemon, but I dont' know enough about the daemon to know for sure. Does adding the |
Having the same issue. In deed when using gradle with the
|
I had the same problem when trying to override the values from the command line, adding |
@marques-work @stevesaliman
I'm sorry to bother you again.i am really didn't get the point of this question.
#154
I'm using
liquibase-gradle-plugin 3.0.1 + gradle 8.10 + gradle.build.kts + liquibase-core:4.29.2
to build my project.My config file is as follows:
When I ran
generateChangelog --stacktrace
I also ran intoInvalid argument '--url': missing required argument
Next I changed the config file to this then when running
generateChangelog --stacktrace
again, the problem magically disappeared.Even if I restore the configuration to
The question still hasn't come up anymore. What happened? How does this work?
If someone else downloads my project, do they need to change the config file around like I did to get it to work?
The text was updated successfully, but these errors were encountered: