The database URL has not been specified either as a parameter or in a properties file

Hello everyone!
Please help me solve my problem …

[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)

my pom file

    <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>

my liquibase.propertires

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

my dataBaseChangeLog file 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>
</databaseChangeLog>

running - mvn liquibase:update
How i can fix this is error?

I don’t use maven at all but a quick google led me to Using Liquibase and your Maven POM File | Liquibase Docs

It says " When using Liquibase and Maven, put your liquibase.properties and changelog files in the src/main/resources folder."

Also “As of version 1.6.1.0 of the Maven plugin, all files are resolved from the Maven test classpath for the Maven project or an absolute path.”

Then the example pom file:

target/classes/liquibase.properties

So it looks like your propertyFile value should not be “./src/…” which is a relative path. I’d suggest it’s not finding your liquibase.properties at all. You gave very cut-down output, are you sure there’s no “file not found” error before the exception trace you gave?

But, as I don’t use this tech, I can’t help further :slight_smile:

Hi @premierrange ,

IThe first thing I notice is the error saying liquibase cannot find the database url. If you look at the url mentioned in the liquibase.properties, there is no database mentioned. For example:
url: jdbc:mysql://localhost:3306/DB_NAME

Kindly confirm if you have have database mentioned in the url.

Hi, thanks for your feedback. My database is there and confirmed by a successful connection using java and jdbc.

connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/recruitment?useUnicode=true&serverTimezone=UTC", "root", "********");

Hi @aditi, I’m not sure why you’re replying to me, I didn’t start this topic :confused: anyway, the original error didn’t say that it couldn’t find the database url, it said “The database URL has not been specified either as a parameter or in a properties file.” … this specified that the software looked for a database URL either as a parameter or in a properties file, but found neither.

The OP thinks he’s specifying the connection URL in a properties file, but there’s no sign in the error stack trace that the properties file was located and read. Failure to find it could cause the error given. That’s why I focused on the mechanism by which the properties file could be found, and suggested the relative path used to specify it could be incorrect.