什么版本的Java可以与Liquibase Maven插件一起使用?

问题描述 投票:2回答:2

是否有适用于Java 9的Liquibase Maven插件版本?我有以下Maven编译器插件设置: -

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.1</version>
      <configuration>
        <source>1.9</source>
        <target>1.9</target>
        <compilerArgument>-proc:none</compilerArgument>
        <fork>true</fork>
        <executable>${javac_path}</executable>
       </configuration>
       <executions>
         <execution>
           <id>default-testCompile</id>
           <phase>test-compile</phase>
           <goals>
             <goal>testCompile</goal>
           </goals>
         </execution>
       </executions>
    </plugin>
  </plugins>
</build>

并有这个Maven liquibase插件

<!-- Run the liquibase scripts -->
<plugin>
  <groupId>org.liquibase</groupId>
  <artifactId>liquibase-maven-plugin</artifactId>
  <version>${version.liquibase}</version>
  <dependencies>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>${version.mysql}</version>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <id>build-test-database</id>
      <phase>process-test-classes</phase>
      <configuration>
        <driver>com.mysql.jdbc.Driver</driver>
        <url>${test.mysql.dataSource.url}</url>
        <username>${test.mysql.db.user}</username>
        <password>${test.mysql.db.password}</password>
        <changeLogFile>${project.build.directory}/db.changelog-master.xml</changeLogFile>
        <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
        <skip>${skipLiquibaseRun}</skip>
        <clearCheckSums>true</clearCheckSums>
      </configuration>
      <goals>
        <goal>update</goal>
      </goals>
    </execution>
  </executions>
</plugin>

但运行插件会因错误而死亡

[INFO] --- liquibase-maven-plugin:3.3.0:update (build-local-database) @ database ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /home/jboss/.jenkins/workspace/springboard/session/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO]   File: /home/jboss/.jenkins/workspace/springboard/database/src/main/resources/liquibase.properties
[INFO] ------------------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Source option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.

当我将编译器版本更改为“1.8”时,不会发生这种情况。

java maven maven-plugin liquibase java-9
2个回答
2
投票

尝试将maven-compiler-plugin配置更改为

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version> <!-- JDK9 compatible version-->
<configuration>
    <source>9</source> <!--not 1.9-->
    <target>9</target>
    <compilerArgument>-proc:none</compilerArgument>
    <fork>true</fork>
    <executable>${javac_path}</executable>
</configuration>

自JDK9发布以来,解析Java版本的原因不是1.9而是9。


2
投票

基于这个问题 - https://github.com/liquibase/liquibase/pull/710我认为你现在最好的选择是克隆liquibase git repo,在本地构建并使用> = 3.6.0-SNAPSHOT进行liquibase。

注意:3.6.0-SNAPSHOT是主人在回答时所使用的版本:)

热门问题
推荐问题
最新问题