2017-03-19 9 views
1

저는 Liquibase를 처음 접했고 Liquibase에 익숙해지기 위해 다소 간단한 프로젝트를 설정했습니다. 불행히도, 매우 초조 한 첫 단계에서 실패하는 것 같습니다.Liquibase로 Maven 빌드가 실패했습니다 : cvc-elt.1 요소 선언을 찾을 수 없습니다.

먼저 내 changelog.xml : 게다가

<?xml version="1.0" encoding="UTF-8"?> 

<databaseChangeLog 
     xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" 
     xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog 
     http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext 
     http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd"> 

    <preConditions> 
     <dbms type="mysql"/> 
    </preConditions> 

    <changeSet id="1" author="maik"> 
     <sql dbms="mysql" endDelimiter=";"> 
      CREATE SCHEMA ods 
     </sql> 
     <createTable tableName="department"> 
      <column name="id" type="int"> 
       <constraints primaryKey="true" nullable="false"/> 
      </column> 
      <column name="name" type="varchar(50)"> 
       <constraints nullable="false"/> 
      </column> 
      <column name="active" type="boolean" defaultValueBoolean="true"/> 
     </createTable> 
    </changeSet> 

</databaseChangeLog> 

, 나는 liquibase.properties 있습니다

내 pom.xml 파일은 다음과 같습니다
driver=com.mysql.jdbc.Driver 
classpath=lib/mysql-connector-java-5.1.41-bin.jar 
url=jdbc:mysql://localhost/prime 
username=bla 
password=bla 

:

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

    <groupId>himstedt</groupId> 
    <artifactId>liquibase</artifactId> 
    <version>1.0-SNAPSHOT</version> 

    <dependencies> 
     <dependency> 
      <groupId>mysql</groupId> 
      <artifactId>mysql-connector-java</artifactId> 
      <version>5.1.41</version> 
     </dependency> 
     <dependency> 
      <groupId>org.liquibase</groupId> 
      <artifactId>liquibase-core</artifactId> 
      <version>3.5.3</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.liquibase</groupId> 
       <artifactId>liquibase-maven-plugin</artifactId> 
       <version>3.0.5</version> 
       <configuration> 
        <propertyFile>src/main/resources/org/liquibase/liquibase.properties</propertyFile> 
        <changeLogFile>src/main/resources/org/liquibase/changelog.xml</changeLogFile> 
       </configuration> 
       <executions> 
        <execution> 
         <phase>process-resources</phase> 
         <goals> 
          <goal>update</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

때 내가 mvn 패키지를 실행하면 다음 오류가 발생합니다.

[email protected]:~/IdeaProjects/liquibase$ mvn package 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building liquibase 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ liquibase --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 2 resources 
[INFO] 
[INFO] --- liquibase-maven-plugin:3.0.5:update (default) @ liquibase --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] Parsing Liquibase Properties File 
[INFO] File: src/main/resources/org/liquibase/liquibase.properties 
[INFO] 'classpath' in properties file is not being used by this task. 
[INFO] ------------------------------------------------------------------------ 
Mon Mar 20 13:28:20 CET 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 
[INFO] Executing on Database: jdbc:mysql://localhost/prime 
INFO 20.03.17 13:28:liquibase: null: null: Successfully acquired change log lock 
SEVERE 20.03.17 13:28:liquibase: null: null: cvc-elt.1: Deklaration des Elements 'databaseChangeLog' kann nicht gefunden werden. 
INFO 20.03.17 13:28:liquibase: null: null: Successfully released change log lock 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.909 s 
[INFO] Finished at: 2017-03-20T13:28:20+01:00 
[INFO] Final Memory: 19M/472M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.0.5:update (default) on project liquibase: Error setting up or running Liquibase: Error parsing line 9 column 75 of src/main/resources/org/liquibase/changelog.xml: cvc-elt.1: Deklaration des Elements 'databaseChangeLog' kann nicht gefunden werden. -> [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/MojoExecutionException 

프로젝트 구조는 다음과 같습니다 나를 위해이 스키마에 문제처럼 보인다,하지만 난 두 번 확인하고 문제를 만들 수 없습니다 Project structure

. 아마 나는 여기서 아주 명백한 것을 놓치고 있습니다.

+0

으로 설정하십시오. 게시 된 changelog.xml XML 파일은 'http : // www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd' XSD. 유효성 검사가 실패한 시스템에서 (1) XSD에 대한 네트워크 연결을 확인하십시오. (2) 게시 한 changelog.xml 파일이 유효성 검증 오류를 생성하는 것과 동일합니다. (3) 게시 한 changelog.xml 파일 [포함 된 XML 파일] (http://stackoverflow.com/questions/23540464/liquibase-command-line-cannot-find-the-declaration-of-element-changeset)의 더 넓은 트리의 일부가 아닙니다. – kjhughes

+0

1) 해당 링크를 브라우저에서 성공적으로 열 수 있습니다. 2) chamgelog.xml을 다시 확인했는데 위에 주어진 파일은 프로젝트의 파일입니다. 3) 위와 같은 changelog/changeset 파일 하나만 있습니다. – Brausepaul

+0

자세한 정보는 첫 번째 게시물 수정. – Brausepaul

답변

4

동일한 버전의 liquibase-core 및 liquibase-maven 플러그인을 사용해야합니다. 예. liquibase-maven-plugin의 버전을 <version>3.5.3</version>