Spring-Boot 1.4.1 + liquibase 3.5.3找不到更改日志文件

时间:2017-03-15 12:53:11

标签: java spring-boot liquibase

我有一个在1.4.1版本上运行的Spring-Boot应用程序(参见下面的pom文件)。现在我想添加Liquibase版本3.5.3。我在第4点遵循了这个site。 同样我只需要添加liquibase-core的依赖项并添加changelog文件。我这样做了(见图)enter image description here

这是我的pom.xml的简短版本(我添加了liquibase依赖项)

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.1.RELEASE</version>
</parent>

<properties>
    <java-version>1.8</java-version>
    <com.atlassian.crowd-version>2.5.5</com.atlassian.crowd-version>
    <org.apache.poi-version>3.15</org.apache.poi-version>
</properties>

<dependencies>

    <!--Spring Boot -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-velocity</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>

    <!-- MyBatis -->
    <dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>1.1.1</version>
    </dependency>

    <!-- PostgreSQL -->
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
    </dependency>

    <!-- Atlassian Crowd -->
    <dependency>
        <groupId>com.atlassian.crowd</groupId>
        <artifactId>crowd-integration-springsecurity</artifactId>
        <version>${com.atlassian.crowd-version}</version>
        <exclusions>
            <exclusion>
                <groupId>freemarker</groupId>
                <artifactId>freemarker</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <!-- UUID -->
    <dependency>
        <groupId>com.eaio.uuid</groupId>
        <artifactId>uuid</artifactId>
        <version>3.2</version>
    </dependency>

    <!-- POI -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>${org.apache.poi-version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${org.apache.poi-version}</version>
    </dependency>

    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.2</version>
    </dependency>

    <!-- Commons IO -->
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.3</version>
    </dependency>

    <!-- Jersey Client -->
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.25.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jta-narayana</artifactId>
    </dependency>

    <!-- Liquibase-->
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
        <version>3.5.3</version>
    </dependency>


</dependencies>

<build>

    <plugins>
        <!-- Compiler settings -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>${java-version}</source>
                <target>${java-version}</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <folders>
                    <folder>src/main/resources/web/templates</folder>
                </folders>
            </configuration>
        </plugin>

        <!-- Generates the release.properties file -->
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>prepare-package</phase>
                    <configuration>
                        <tasks>

                            <property name="release.properties"
                                value="${project.build.directory}/classes/release.properties" />

                            <delete file="${release.properties}" />

                            <echo file="${release.properties}" append="false">release=${project.version}-b${env.BUILD_NUMBER}</echo>

                        </tasks>

                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

这就是我添加到application.properties

的内容
liquibase.change-log=classpath*:db/changelog/changelog-master.xml

运行应用程序时出现的错误是:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration$LiquibaseConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot find changelog location: ServletContext resource [/classpath*:db/changelog/changelog-master.xml] (please add changelog or check your Liquibase configuration)
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1575)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)

可能是我必须添加更多配置吗?

如果您需要更多信息,请与我们联系。

0 个答案:

没有答案