Scala 正在将play framework项目更新为Java 11,但找不到正确的依赖项版本
将一个现有的maven项目从Java8更新到11,我正在努力找到依赖和插件版本的正确组合。 其中一个模块使用play框架及其相关依赖项,下面是它们现在设置的内容:Scala 正在将play framework项目更新为Java 11,但找不到正确的依赖项版本,scala,playframework,sbt,akka,java-11,Scala,Playframework,Sbt,Akka,Java 11,将一个现有的maven项目从Java8更新到11,我正在努力找到依赖和插件版本的正确组合。 其中一个模块使用play框架及其相关依赖项,下面是它们现在设置的内容: java: 11.0.5 scala: 2.12.8 sbt: 0.13.17 sbt-compiler-maven-plugin: 1.0.0 sbtrun-maven-plugin:
java: 11.0.5
scala: 2.12.8
sbt: 0.13.17
sbt-compiler-maven-plugin: 1.0.0
sbtrun-maven-plugin: 1.0.1
play: 2.6.21
play2-maven-plugin: 1.0.0-rc5
play2-provider-play26: 1.0.0-rc5
akka: 2.5.27
这给了我以下生成错误:
[ERROR] Failed to execute goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5:enhance (default-play2-enhance) on project services: Execution default-play2-enhance of goal com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5:enhance failed: An API incompatibility was encountered while executing com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5:enhance: java.lang.NoSuchMethodError: 'scala.collection.mutable.ArrayOps scala.Predef$.byteArrayOps(byte[])'
[ERROR] -----------------------------------------------------
[ERROR] realm = extension>com.google.code.play2-maven-plugin:play2-maven-plugin:1.0.0-rc5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
...
...
...
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
注意:我希望将akka保留到2.5.x版本,因为2.6.x需要大量的代码更改,但如果需要,将转到更高的版本
<?xml version="1.0"?>
<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>
<parent>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>version</version>
</parent>
<artifactId>artifactId</artifactId>
<packaging>play2</packaging>
<name>name</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>typesafe</id>
<url>http://repo.typesafe.com/typesafe/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.typesafe.play</groupId>
<artifactId>play_2.12</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe.play</groupId>
<artifactId>play-test_2.12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.typesafe.play</groupId>
<artifactId>play-java_2.12</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-stream_2.12</artifactId>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert-core</artifactId>
</dependency>
</dependencies>
<build>
<!-- Play source directory -->
<sourceDirectory>${basedir}/app</sourceDirectory>
<testSourceDirectory>${basedir}/test</testSourceDirectory>
<resources>
<resource>
<directory>${basedir}/conf</directory>
</resource>
<resource>
<directory>${basedir}/public</directory>
<targetPath>public</targetPath>
</resource>
<resource>
<directory>${basedir}/target/sbt/web/public/main</directory>
<targetPath>public</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.google.code.play2-maven-plugin</groupId>
<artifactId>play2-maven-plugin</artifactId>
<version>1.0.0-rc5</version>
<extensions>true</extensions>
<configuration>
<mainLang>java</mainLang>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.play2-maven-plugin</groupId>
<artifactId>play2-provider-play27</artifactId>
<version>1.0.0-rc5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>default-play2-enhance</id>
<goals>
<goal>enhance</goal>
</goals>
</execution>
<execution>
<phase>package</phase>
<goals>
<goal>dist</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.code.sbt-compiler-maven-plugin</groupId>
<artifactId>sbt-compiler-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin>
<groupId>com.google.code.sbtrun-maven-plugin</groupId>
<artifactId>sbtrun-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>compile-assets</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<args>web-assets:assets</args>
<jvmArgs>-Dscala.version=2.12.8</jvmArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>default-jar</id>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- <!– These empty tags keep IntelliJ quiet –> -->
<name />
<regex />
<source />
<value />
<fileSet />
<artifacts>
<artifact>
<file>${project.build.directory}/service-${project.version}-dist.zip</file>
<type>zip</type>
<classifier>dist</classifier>
</artifact>
</artifacts>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>eclipse</id> <!-- for M2Eclipse only -->
<build>
<directory>${project.basedir}/target-eclipse</directory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<skipMain>true</skipMain>
<skip>true</skip>
<source>11</source>
<target>11</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<goals><goal>compile</goal></goals>
</execution>
<execution>
<id>default-testCompile</id>
<goals><goal>testCompile</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
4.0.0
groupId
人工的
版本
人工的
剧本2
名称
UTF-8
类型安全
http://repo.typesafe.com/typesafe/releases/
com.typesafe.play
播放2.12
com.typesafe.play
播放测试2.12
测试
com.typesafe.play
play-java_2.12
com.fasterxml.jackson.datatype
jackson数据类型joda
com.typesafe.akka
akka-stream_2.12
org.easytesting
fest断言核心
${basedir}/app
${basedir}/test
${basedir}/conf
${basedir}/public
公众的
${basedir}/target/sbt/web/public/main
公众的
com.google.code.play2-maven-plugin
play2 maven插件
1.0.0-rc5
真的
JAVA
com.google.code.play2-maven-plugin
play2-provider-play27
1.0.0-rc5
默认播放2-增强
增强
包裹
距离
com.google.code.sbt-compiler-maven-plugin
sbt编译器maven插件
1.0.0
com.google.code.sbtrun-maven-plugin
sbtrumaven插件
1.0.1
汇编资产
产生资源
跑
web资产:资产
-Dscala.version=2.12.8
org.apache.maven.plugins
maven jar插件
2.6
默认jar
真的
真的
org.codehaus.mojo
构建助手maven插件
1.12
附加工件
包裹
附加工件
${project.build.directory}/service-${project.version}-dist.zip
拉链
距离
日食
${project.basedir}/target eclipse
org.apache.maven.plugins
maven编译器插件
真的
真的
11
11
默认编译
编译
默认测试编译
测试编译
编辑:
更新了SBT和Scala版本,根据Scala文档添加了修订的pom
您的SBT版本与Java 11不兼容。我建议升级到sbt.version=1.2.3
如果你不想升级到更高的版本,你正在使用的Akka版本应该是好的
更新:
我可以看到您将sbt版本更新为0.13.17,并尝试使用更高版本,但您应该忘记sbt 0.13,坚持使用sbt 1.x,因为sbt 0.13使用的是scala 2.10和sbt 1.x scala 2.12
我还注意到你没有maven编译器插件的版本标签。如果您使用的是maven 3,它应该会因为缺少这个标记而无法构建,而且因为它不是,我猜您使用的是maven 2,它应该升级。您还应该向maven编译器插件添加3.8.0版本标记。