2017-03-22 69 views
0

我使用Liquibase Maven插件爲Oracle數據庫12C和我正在運行的update命令以下錯誤:Liquibase Maven插件不工作

未能執行目標org.liquibase:liquibase - Maven的插件3.4.1:更新(默認值)項目liquibase:錯誤設置或運行liquibase:liquibase.exception.DatabaseException:值java.sql.SQLException:ORA-28040:沒有匹配的認證協議

我看到了有關關於這個問題的堆棧溢出帖子建議對sqlnet.ora文件進行更改,但使用以下命令w獸人完美通過命令行使用完全相同的changelog:

Java的罐子〜/ .m2目錄/庫/組織/ liquibase/liquibase核心/ 3.5.3/liquibase核-3.5.3.jar - -driver = oracle.jdbc.OracleDriver --classpath =/Users/nsalvi/Downloads/ojdbc6.jar --url =「假url」--username =「假用戶名」--password =「假密碼」--changeLogFile = /Users/nsalvi/Downloads/liquibase-example-master-2/src/main/resources/db/dbChangelog.xml更新

上面我引用的驅動程序類路徑出現在我的本地的。

我的POM片段如下所示:

<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安裝我得到的非認證協議錯誤。我的數據庫更新日誌如下:

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文件中進行更改是問題,因爲查詢在從命令行運行時完美工作。

在此先感謝!

回答

0

您可以使用以下幾個階段之一(從Maven的網站上得到): 驗證 - 驗證項目是否正確,以及所有必要的信息,請

  • 編譯 - 編譯項目的源代碼
  • 測試 - 使用合適的單元測試框架測試已編譯的源代碼。這些測試不應該要求打包代碼或部署
  • 軟件包 - 獲取已編譯的代碼並將其打包爲可分發的格式,例如JAR。
  • 驗證 - 運行的集成測試結果的任何檢查,以確保質量標準,滿足
  • 安裝 - 軟件包安裝到本地倉庫,用作其他項目的依賴本地
  • 部署 - 在構建完成環境中,將最終包複製到遠程存儲庫,以便與其他開發人員和項目共享。