簡體   English   中英

Liquibase Maven插件可以使用哪個Java版本?

[英]What version of Java works with the Liquibase Maven plugin?

是否有可與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”時,不會發生這種情況。

基於這個問題-https: //github.com/liquibase/liquibase/pull/710我認為目前最好的選擇是克隆liquibase git repo,在本地構建它,並使用> = 3.6.0-SNAPSHOT作為liquibase。

注意:3.6.0-SNAPSHOT是在此答案時,主機已打開的版本:)

嘗試將您的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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM