簡體   English   中英

Liquibase ERROR 數據庫 URL 尚未指定為參數或屬性文件

[英]Liquibase ERROR The database URL has not been specified either as a parameter or in a properties file

我研究 liquibase 工具。 使用教程,我在 pom.xml,liquibase.properties 中配置了數據,但是我得到一個錯誤,無法以任何方式解決這個問題。

運行命令 - mvn liquibase:update

我該如何解決這個錯誤?

堆棧跟蹤

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:4.6.1:update (default-cli) on project crudDataBaseApplication: The database URL has not been specified either as a parameter or in a properties file. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.liquibase:liquibase-maven-plugin:4.6.1:update (default-cli) on project crudDataBaseApplication: The database URL has not been specified either as a parameter or in a properties file.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

我的 pom 文件

    <build>
    <plugins>
        <plugin>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-maven-plugin</artifactId>
            <version>4.6.1</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <configuration>
                        <propertyFile>./src/main/resources/liquibase.properties</propertyFile>
                        <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
                    </configuration>
                    <goals>
                        <goal>update</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我的 liquibase.properties

changeLogFile=./src/main/resources/master.xml 
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/recruitment?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTime 
zone=UTC
username=root
password=*********
verbose=true
dropFirst=false

我的dataBaseChangeLogFile master.xml

<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
  http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<changeSet id="dateBaseOperations" author="Dmitry Polischuk">
    <sqlFile path="./src/main/resources/tables_creation.sql"/>
</changeSet>

看起來路徑不正確。 而不是寫./src/..你應該寫src/..在文件路徑中。

您還可以嘗試使用允許您使用環境變量的 Pro 功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM