【问题标题】:Liquibase maven plugin not workingLiquibase maven插件不起作用
【发布时间】:2017-08-15 00:52:33
【问题描述】:

我正在为 Oracle 12c 数据库使用 Liquibase maven 插件,运行更新命令时出现以下错误:

无法在项目 liquibase 上执行目标 org.liquibase:liquibase-maven-plugin:3.4.1:update(默认):设置或运行 Liquibase 时出错:liquibase.exception.DatabaseException: java.sql.SQLException: ORA- 28040: 没有匹配的身份验证协议

我看到有关此问题的相关堆栈溢出帖子,其中建议对 sqlnet.ora 文件进行更改,但以下命令使用完全相同的更改日志通过命令行完美运行:

java -jar ~/.m2/repository/org/liquibase/liquibase-core/3.5.3/liquibase-core-3.5.3.jar --driver=oracle.jdbc.OracleDriver --classpath=/Users/ nsalvi/Downloads/ojdbc6.jar --url="fake url" --username="fake username" --password="fake password" --changeLogFile=/Users/nsalvi/Downloads/liquibase-example-master-2/ src/main/resources/db/dbChangelog.xml 更新

上面我引用了我本地的驱动程序类路径。

我的 pom sn-p 如下所示:

    <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>${liquibase.version}</version>
        <configuration>
            <propertyFileWillOverride>true</propertyFileWillOverride>
            <propertyFile>src/main/resources/liquibase.properties</propertyFile>
        </configuration>
        <executions>
            <execution>
                <phase>process-resources</phase>
                <goals>
                     <goal>update</goal>
                </goals>
            </execution>
         </executions>
         <dependencies>
            <dependency>
                <groupId>com.oracle</groupId>
                <artifactId>ojdbc6</artifactId>
                <version>${oracle.version}</version>
            </dependency>
         </dependencies>
    </plugin>

当我运行 maven install 时,我得到了非身份验证协议错误。我的数据库变更日志如下:

liquibase.properties:

contexts: local 
changeLogFile: db/dbChangelog.xml
driver: oracle.jdbc.OracleDriver
url: fake url
username: fake username
password: fake password
verbose: true 
dropFirst: false 

dbChangelog.xml:

    <databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.8"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.8
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.8.xsd">
    <preConditions>
        <dbms type="oracle" />
        <runningAs username="fake" />
    </preConditions>

    <changeSet id="1" author="nishant">
        <preConditions onFail="WARN">
            <sqlCheck expectedResult="9">select count(*) from CA_PROJECT_T</sqlCheck>
        </preConditions>
        <comment>Comments should go after preCondition. If they are before then liquibase usually gives error.</comment>
    </changeSet>
</databaseChangeLog>

有什么我想念的吗? P.S.-当有问题的数据库是 mysql 而不是 oracle 时,maven 插件工作得很好,我不认为在 sqlnet.ora 文件中进行更改是这里的问题,因为从命令行运行时查询工作得很好。

提前致谢!

【问题讨论】:

    标签: java eclipse oracle maven liquibase


    【解决方案1】:

    您可以使用以下阶段之一(取自 maven 网站): validate - 验证项目是否正确,所有必要的信息都可用

    • compile - 编译项目的源代码
    • test - 使用合适的单元测试框架测试编译的源代码。这些测试不应要求将代码打包或 部署
    • 打包 - 获取已编译的代码并将其打包成可分发的格式,例如 JAR。
    • 验证 - 对集成测试的结果进行任何检查,以确保满足质量标准
    • install - 将包安装到本地存储库中,用作本地其他项目的依赖项
    • 部署 - 在构建环境中完成,将最终包复制到远程存储库,以便与其他开发人员和项目共享。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-11
      • 2016-07-05
      • 2017-05-15
      • 2020-10-12
      • 2016-02-05
      • 2011-11-11
      • 2017-07-06
      相关资源
      最近更新 更多