【发布时间】:2019-12-13 21:13:29
【问题描述】:
我的 maven 项目依赖于通过 liquibase 通过另一个外部项目创建的数据库模式。 为了测试我的项目,我需要在我的机器上生成这个数据库结构。 有没有办法在我的项目的 pom 本身中指定 liquibase 项目详细信息(组 id、工件、版本等以及必要的 liquibase 参数),以便在执行任何测试之前生成 db 结构。
P.S.:我知道如果项目确实存在于我的机器中,我可以使用类似下面的东西:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>create-unitttest-db-schema</id>
<phase>process-test-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<skip>${skipSchemaCreation}</skip>
<executable>mvn</executable>
<arguments>
<argument>-f</argument>
<argument>../proj-liquibase-db/pom.xml</argument>
<argument>-P${proj.test.liquibase.create.profile},create</argument>
<argument>clean</argument>
<argument>install</argument>
<argument>-DdefaultSchemaName=${proj.test.schema.unittest}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
我想在这里指定proj-liquibase-db的项目坐标,而不是它的pom文件的路径。
P.P.S:如果不可能,请告诉我并提出一些替代方案,因为我真的被困在这里了。
【问题讨论】: