我正在尝试使用liquibase更新两个数据库。(我将来可能需要添加更多数据库,因此不能真正使用多个配置文件选项),但是当我运行以下命令来更新数据库架构时。
mvn resources:resources liquibase:update
我收到错误消息
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ScannerService 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-cli) @ ScannerService ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 2 resources
[INFO]
[INFO] --- liquibase-maven-plugin:3.6.3:update (default-cli) @ ScannerService ---
[INFO] ------------------------------------------------------------------------
[INFO] Starting Liquibase at Tue, 02 Jul 2019 10:59:06 IST (version 3.6.3 built at 2019-01-29 11:34:48)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.271 s
[INFO] Finished at: 2019-07-02T10:59:06+05:30
[INFO] Final Memory: 21M/307M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.6.3:update (default-cli) on project ScannerService: The database URL has not been specified either as a parameter or in a properties file. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
下面是我配置的POM.xml。我在具有不同ID的插件中添加了多个执行。指定了驱动程序和URL,但仍然出现类似“未指定URL”的错误。早些时候我没有使用其他版本的liquibase插件指定驱动程序,然后将插件版本更改为最新的可用版本。但是仍然没有成功。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.prgx</groupId>
<artifactId>ScannerService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ScannerService</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fi.solita.clamav</groupId>
<artifactId>clamav-client</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.6.3</version>
<executions>
<execution>
<id>id1</id>
<phase>process-resources</phase>
<configuration>
<changeLogFile>src/main/resources/changelog_p.xml</changeLogFile>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost/mypdb</url>
<username>postgres</username>
<password>******</password>
<!-- ... connection properties ... -->
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
<execution>
<id>id2</id>
<phase>process-resources</phase>
<configuration>
<changeLogFile>src/main/resources/changelog_m.xml</changeLogFile>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost/mydb</url>
<username>root</username>
<password>******</password>
<!-- ... connection properties ... -->
</configuration>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我在SO上搜索了类似的问题,但没有成功,感谢任何帮助,谢谢!