JHipster 6.0.1:Liquibase 任务失败
JHipster 6.0.1: Liquibase tasks fail
只是试用 JHipster v6.0.1,遵循示例博客应用程序 (http://gist.asciidoctor.org/?github-mraible/jhipster5-demo//README.adoc)。选择 Gradle 作为构建工具,在开发和生产中使用 MariaDB,liquibase 任务失败。
安装开发环境:
- 安装 MariaDB 10.3
- 安装 JDK 11 并相应地设置环境 variables/path
- 安装节点 (10.15.3) => npm v6.4.1
- 安装 yarn (1.15.2)
- 启动 shell 并在命令行中:
- 安装 Yoeman:
npm install -g yo
- 安装 JHipster:
npm install -g generator-jhipster
创建一个新目录,blog
,cd 进入它并输入:jhipster
- 选择与上面链接的教程几乎相同的选项,在开发和生产中都使用 MariaDB,并使用 Gradle 作为构建工具。
- 启动服务器:
./gradlew
- 运行:
yarn start
一切正常。数据库表按预期创建和填充,Web 应用程序运行良好。
现在,当我停止服务器并尝试 运行 任何 liquibase 任务时,我得到了同样的错误。例如,命令行中的 运行ning: ./gradlew liquibaseClearChecksums
结果为:
> Task :liquibaseClearChecksums FAILED
During the build, one or more dependencies that were declared without a version failed to resolve:
org.mariadb.jdbc:mariadb-java-client:
Did you forget to apply the io.spring.dependency-management plugin to the blog project?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':liquibaseClearChecksums'.
> Could not resolve all files for configuration ':liquibaseRuntime'.
> Could not find org.mariadb.jdbc:mariadb-java-client:.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
1 actionable task: 1 executed
堆栈跟踪提供了更多信息:
Could not resolve all files for configuration ':liquibaseRuntime'.
> Could not find org.mariadb.jdbc:mariadb-java-client:.
Required by:
project :
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':liquibaseClearChecksums'.
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':liquibaseRuntime'.
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException:
Could not find org.mariadb.jdbc:mariadb-java-client:.
Required by:
project :
我在 Windows 10 和 Linux openSUSE 15 上得到了相同的结果。但是,当使用 Maven 时,liquibase 任务工作正常。这只是我吗?有人知道为什么吗?
[JHipster:6.0.1; JDK11; MariaDB 10.3.14;节点 v10.15.3;纱线 v1.15.2; npm v6.9.0; Gradlev5.4.1]
PS: 删除 JHipster 6.0.1,然后安装 v5.8.2 (npm install -g generator-jhipster@5.8.2
),重复上述过程,Gradle liquibase 任务有效!我认为这是新的 JHipster 6.0.1 部署的错误...我应该 I/how 向开发团队报告这个问题吗?有临时修复的想法吗?
此外,还花时间比较了两个版本(5.8.2 和 6.0.1)的 build.gradle
文件;它们完全不同,除了:5.8.2 版本直接引用 io.spring.dependency-management
插件,但 6.0.1 版本没有...
我遇到了同样的问题并禁用了 "cacheProvider no" 缓存。
当您 运行 应用程序时,二级缓存存在另一个问题,我认为这是因为数据库驱动程序。
希望能帮到你!
好的!我有办法...
我在 build.gradle
文件中添加了以下 +
行(从第 28 行开始):
id "org.sonarqube" version "2.7"
+ id "io.spring.dependency-management" version "1.0.7.RELEASE"
//jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
}
sourceCompatibility=1.8
targetCompatibility=1.8
assert System.properties["java.specification.version"] == "1.8" || "11" || "12"
apply plugin: "org.springframework.boot"
+ apply plugin: "io.spring.dependency-management"
apply plugin: "propdeps"
我选择了 io.spring.dependency-management
版本 1.0.7,因为 the Gradle plugin page 将其引用为最新版本(在撰写本文时)。
我现在可以 运行 ./gradlew liquibaseClearChecksums
取得成功。
运行 ./gradlew liquibaseDiffChangeLog
但是失败了。打开堆栈跟踪,我收到以下错误:
:liquibaseDiffChangeLog FAILED
liquibase-plugin: Running the 'main' activity...
Starting Liquibase at Tue, 21 May 2019 07:16:59 PDT (version 3.6.3 built at 2019-01-29 11:34:48)
Unexpected error running Liquibase: The option --referenceUrl is required.
liquibase.exception.CommandLineParsingException: The option --referenceUrl is required.
at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:1419)
at liquibase.integration.commandline.Main.doMigration(Main.java:1026)
at liquibase.integration.commandline.Main.run(Main.java:199)
at liquibase.integration.commandline.Main.main(Main.java:137)
为了解决这个问题,我copy/paste把liquibase
/activities
/diffLog
referenceUrl
参数改成了liquibase
/activities
/main
部分(参见下面的 +
行):
liquibase {
activities {
main {
driver "org.mariadb.jdbc.Driver"
url "jdbc:mariadb://localhost:3306/blog"
username "<username>"
password "<password>"
changeLogFile "src/main/resources/config/liquibase/master.xml"
defaultSchemaName ""
logLevel "debug"
classpath "src/main/resources/"
+ referenceUrl "hibernate:spring:org.jhipster.blog.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
}
我现在可以 运行 ./gradlew liquibaseDiffChangeLog
取得成功。通过这些更改,我成功地在 Linux 和 Windows 10 上测试了 liquibase 任务。
我是唯一注意到这一点的人吗? JHipster 团队没有注意到这一点吗? JHipster/Gradle/liquibase 配置没有被测试吗?我的修复是完整的解决方案吗?
有JHipster/Gradle/liquibase配置经验的人可以提供一些insight/confirmation...吗?
只是试用 JHipster v6.0.1,遵循示例博客应用程序 (http://gist.asciidoctor.org/?github-mraible/jhipster5-demo//README.adoc)。选择 Gradle 作为构建工具,在开发和生产中使用 MariaDB,liquibase 任务失败。
安装开发环境:
- 安装 MariaDB 10.3
- 安装 JDK 11 并相应地设置环境 variables/path
- 安装节点 (10.15.3) => npm v6.4.1
- 安装 yarn (1.15.2)
- 启动 shell 并在命令行中:
- 安装 Yoeman:
npm install -g yo
- 安装 JHipster:
npm install -g generator-jhipster
- 安装 Yoeman:
创建一个新目录,
blog
,cd 进入它并输入:jhipster
- 选择与上面链接的教程几乎相同的选项,在开发和生产中都使用 MariaDB,并使用 Gradle 作为构建工具。
- 启动服务器:
./gradlew
- 运行:
yarn start
一切正常。数据库表按预期创建和填充,Web 应用程序运行良好。
现在,当我停止服务器并尝试 运行 任何 liquibase 任务时,我得到了同样的错误。例如,命令行中的 运行ning: ./gradlew liquibaseClearChecksums
结果为:
> Task :liquibaseClearChecksums FAILED
During the build, one or more dependencies that were declared without a version failed to resolve:
org.mariadb.jdbc:mariadb-java-client:
Did you forget to apply the io.spring.dependency-management plugin to the blog project?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':liquibaseClearChecksums'.
> Could not resolve all files for configuration ':liquibaseRuntime'.
> Could not find org.mariadb.jdbc:mariadb-java-client:.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
1 actionable task: 1 executed
堆栈跟踪提供了更多信息:
Could not resolve all files for configuration ':liquibaseRuntime'.
> Could not find org.mariadb.jdbc:mariadb-java-client:.
Required by:
project :
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':liquibaseClearChecksums'.
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':liquibaseRuntime'.
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException:
Could not find org.mariadb.jdbc:mariadb-java-client:.
Required by:
project :
我在 Windows 10 和 Linux openSUSE 15 上得到了相同的结果。但是,当使用 Maven 时,liquibase 任务工作正常。这只是我吗?有人知道为什么吗?
[JHipster:6.0.1; JDK11; MariaDB 10.3.14;节点 v10.15.3;纱线 v1.15.2; npm v6.9.0; Gradlev5.4.1]
PS: 删除 JHipster 6.0.1,然后安装 v5.8.2 (npm install -g generator-jhipster@5.8.2
),重复上述过程,Gradle liquibase 任务有效!我认为这是新的 JHipster 6.0.1 部署的错误...我应该 I/how 向开发团队报告这个问题吗?有临时修复的想法吗?
此外,还花时间比较了两个版本(5.8.2 和 6.0.1)的 build.gradle
文件;它们完全不同,除了:5.8.2 版本直接引用 io.spring.dependency-management
插件,但 6.0.1 版本没有...
我遇到了同样的问题并禁用了 "cacheProvider no" 缓存。 当您 运行 应用程序时,二级缓存存在另一个问题,我认为这是因为数据库驱动程序。 希望能帮到你!
好的!我有办法...
我在 build.gradle
文件中添加了以下 +
行(从第 28 行开始):
id "org.sonarqube" version "2.7"
+ id "io.spring.dependency-management" version "1.0.7.RELEASE"
//jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
}
sourceCompatibility=1.8
targetCompatibility=1.8
assert System.properties["java.specification.version"] == "1.8" || "11" || "12"
apply plugin: "org.springframework.boot"
+ apply plugin: "io.spring.dependency-management"
apply plugin: "propdeps"
我选择了 io.spring.dependency-management
版本 1.0.7,因为 the Gradle plugin page 将其引用为最新版本(在撰写本文时)。
我现在可以 运行 ./gradlew liquibaseClearChecksums
取得成功。
运行 ./gradlew liquibaseDiffChangeLog
但是失败了。打开堆栈跟踪,我收到以下错误:
:liquibaseDiffChangeLog FAILED
liquibase-plugin: Running the 'main' activity...
Starting Liquibase at Tue, 21 May 2019 07:16:59 PDT (version 3.6.3 built at 2019-01-29 11:34:48)
Unexpected error running Liquibase: The option --referenceUrl is required.
liquibase.exception.CommandLineParsingException: The option --referenceUrl is required.
at liquibase.integration.commandline.Main.createReferenceDatabaseFromCommandParams(Main.java:1419)
at liquibase.integration.commandline.Main.doMigration(Main.java:1026)
at liquibase.integration.commandline.Main.run(Main.java:199)
at liquibase.integration.commandline.Main.main(Main.java:137)
为了解决这个问题,我copy/paste把liquibase
/activities
/diffLog
referenceUrl
参数改成了liquibase
/activities
/main
部分(参见下面的 +
行):
liquibase {
activities {
main {
driver "org.mariadb.jdbc.Driver"
url "jdbc:mariadb://localhost:3306/blog"
username "<username>"
password "<password>"
changeLogFile "src/main/resources/config/liquibase/master.xml"
defaultSchemaName ""
logLevel "debug"
classpath "src/main/resources/"
+ referenceUrl "hibernate:spring:org.jhipster.blog.domain?dialect=org.hibernate.dialect.MySQL5InnoDBDialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
}
我现在可以 运行 ./gradlew liquibaseDiffChangeLog
取得成功。通过这些更改,我成功地在 Linux 和 Windows 10 上测试了 liquibase 任务。
我是唯一注意到这一点的人吗? JHipster 团队没有注意到这一点吗? JHipster/Gradle/liquibase 配置没有被测试吗?我的修复是完整的解决方案吗?
有JHipster/Gradle/liquibase配置经验的人可以提供一些insight/confirmation...吗?