首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将play框架项目更新到Java 11,无法找到正确的依赖版本

将play框架项目更新到Java 11,无法找到正确的依赖版本
EN

Stack Overflow用户
提问于 2020-02-06 07:49:35
回答 1查看 1.2K关注 0票数 1

将现有的maven项目从Java 8更新到11,我很难找到依赖和插件版本的正确组合。其中一个模块使用play框架及其相关的依赖项,下面是它们的设置:

代码语言:javascript
运行
AI代码解释
复制
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

这给了我以下构建错误:

代码语言:javascript
运行
AI代码解释
复制
[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需要大量的代码更改,但如果有必要,将转到更高的版本

代码语言:javascript
运行
AI代码解释
复制
<?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>
                    <!-- &lt;!&ndash; These empty tags keep IntelliJ quiet &ndash;&gt; -->
                    <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>

编辑:更新的SBT和Scala版本,添加了已编辑的pom

EN

回答 1

Stack Overflow用户

发布于 2020-02-06 12:10:09

根据scala文档https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html

您的SBT版本与Java 11不兼容。

如果您不想升级到更高的版本,那么您使用的Akka版本应该是好的。

更新:

我可以看到您将sbt版本更新为0.13.17,并且尝试了更高的版本,但是您应该忘记SBT0.13并坚持使用SBT1.x,因为SBT0.13使用scala 2.10,而SBT1.xScala2.12。

我还注意到您没有maven编译器插件的版本标记。如果您使用的是maven 3,它应该会因为缺少这个标记而无法构建,而且由于它不是,我猜您使用的是应该升级的maven 2。此外,您还应该添加3.8.0版本标记到maven编译器插件中。

检查本指南,看看如何正确配置这个插件用于java 11。您还应该检查其他说明,看看是否所有的东西都配置正确。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60098832

复制
相关文章
项目axios依赖版本更新
从v0.22.0开始,Axios 支持以 fetch API 方式——AbortController取消请求:
般般
2022/10/14
2.6K0
dotnet tool 自动找到项目里面重复的 NuGet 依赖项
使用新的 SDK 风格的 csproj 的时候,允许 NuGet 包进行依赖传递。意思是如果我 A 项目安装了库 L 那么如果有 B 项目引用 A 项目,那么自动 B 项目也就安装了库 L 而不需要项目 B 再次手动安装。也就是如果此时的 B 项目里面也加上了 L 库的安装,那么这个安装就是多余的。本文安利大家一个工具,可以自动了解有哪些项目的哪些库是多余安装的,通过依赖传递就能安装上,不需要手动安装,可以删除
林德熙
2021/02/22
7720
无法为 WSDD 操作找到匹配的 Java 操作
我发现了错误。 只需要把“AndrQues”改成“andrQues”,程序就可以正常运行了。
matinal
2023/10/13
2150
Google Play新规:不提交这个编码,App将无法上线
这项新措施能有效提高平台的安全性和可信度,同时也能够有效遏制新账户提交恶意软件的行为。
FB客服
2023/08/08
6320
Google Play新规:不提交这个编码,App将无法上线
解决 IDEA 无法找到 java.util.Date 的问题
最近在项目中频繁使用到 java.util.Date,但是使用 IDEA 提示查找 Date 类,却无法找到 java.util.Date。
andyxh
2019/09/10
1.9K0
解决 IDEA 无法找到 java.util.Date 的问题
Java项目版本错误
今天项目启动发现一个小错误 Error: java: java.lang.ExceptionInInitializerError com.sun.tools.javac.code.TypeTags
暴躁的程序猿
2022/03/23
7590
Java项目版本错误
在Java项目中打印错误日志的正确姿势,排查问题更方便,非常实用!
在程序中打错误日志的主要目标是为更好地排查问题和解决问题提供重要线索和指导。但是在实际中打的错误日志内容和格式变化多样,错误提示上可能残缺不全、没有相关背景、不明其义,使得排查解决问题成为非常不方便或者耗时的操作。
lyb-geek
2020/10/09
1.6K0
【Java】idea已创建的项目导入依赖
德宏大魔王
2023/08/08
3060
【Java】idea已创建的项目导入依赖
体验 Scala 语言的 Play Web 框架
在本文中将介绍 Scala 的 Play Web 开发框架。我们将会学习如何创建一个 Play 项目,使用开发工具生成我们的第一个项目以及实现自定义的功能,另外还将体验一下 Play 框架的测试能力。
RiemannHypothesis
2022/09/28
2.1K0
不要让框架控制你的项目,过度依赖框架会害了你
作者 | Bèr Kessels、译者 | 弯月    出品 | CSDN(ID:CSDNnews) 原文链接:https://berk.es/2022/09/06/frameworks-harm-maintenance/ 在本文中,我们来探讨一下使用框架构建软件,对软件的可维护性有哪些危害。我认为: 使用框架有损于软件的可维护性。 框架与个人或团队有着不同的目标。 框架设计中的权衡会危及项目的可维护性。 框架的构建初衷就是为了控制你的项目。 以解耦的方式采用框架,不仅能享受框架带来的好处,而且还可以避免损
程序猿DD
2023/04/04
8910
不要让框架控制你的项目,过度依赖框架会害了你
Intellij Idea 使用SVN更新到指定版本
默认情况下,changes视图,在Incoming中更新任意版本,整个项目都会被更新。这样会导致的更新到很多不应该更新的版本。
程序新视界
2022/05/06
2.8K0
Intellij Idea 使用SVN更新到指定版本
pycharm安装tensorflow版本无法找到_pycharm安装后无解释器
keras需要在TensorFlow之上才能运行。所以这里安装TensorFlow。TensorFlow需要vs环境,需要wein64位环境,所以32位的小伙伴需要升级为64位系统以后才行。
全栈程序员站长
2022/09/25
1.2K0
FastDFS依赖无法导入
FastDFS依赖无法导入 fastdfs-client-java 导入爆红 <!-- FastDFS--> <dependency> <groupId>org.csource</groupId> <artifactId>fastdfs-client-java</artifactId> <version>1.29-SNAPSHOT</version> </dependency> 解决方法 1.先从 github 上拉取下来 fastdfs-client-java 项目 gi
张小驰出没
2021/12/06
1.3K0
FastDFS依赖无法导入
Go版本依赖--伪版本
在go.mod中通常使用语义化版本来标记依赖,比如v1.2.3、v0.1.5等。因为go.mod文件通常是go命令自动生成并修改的,所以实际上是go命令习惯使用语义化版本。
冬夜先生
2021/09/03
1K0
Eclipse java SE版本解决无法新建web项目问题「建议收藏」
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/105861.html原文链接:https://javaforall.cn
全栈程序员站长
2022/08/09
5270
Eclipse java SE版本解决无法新建web项目问题「建议收藏」
来玩Play框架02 响应
我上一章总结了Play框架的基本使用。这一章里,我将修改和增加响应。 HTTP协议是按照“请求-响应”的方式工作。Play框架的核心是用动作(Action)来完成“请求-响应”。一个动作负责处理一种请求。一个项目可能要定义许多动作。复杂的网站,可能要定义上百个动作。所以,Play使用控制器(Controller)和URL路由(URL routing)来组织管理动作。控制器用于给动作分类。URL路由(routes)记录了URL和动作的对应关系。 IDE 在开发代码之前,先简单介绍如何使用Eclipse,开发P
Vamei
2018/01/18
8770
来玩Play框架02 响应
来玩Play框架01 简介
说到网络框架,Ruby的Ruby on Rail和Python的Django都相当轻巧好用,但Java下的框架,则要沉重很多。有人因此质疑Java语言本身是否符合网络时代的需求。Java大神们对这一问
Vamei
2018/01/18
1.5K0
来玩Play框架01 简介
来玩Play框架01 简介
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明。谢谢!
Vamei
2018/09/25
1.1K0
来玩Play框架01 简介
来玩Play框架03 模板
在上一章节中,我把字符串通过ok()返回给客户。我可以把一个完整的html页面放入字符串中返回。然而,现代的框架都提供了更好的方法——模板。模板将视图和数据分开。服务器可以把不同的数据传递给同一个模板,从而产生不同的页面。 Play同样也有一套模板系统。模板的大部分内容都可以用html写,作为视图,而在一些特别的地方,预留给数据参数。在模板中,用Scala语言来调用参数。 使用模板 我首先创建一个模板,纯粹起视图功能。在app/views文件夹中,新建文件index.scala.html (如果已有,则删除
Vamei
2018/01/18
8410
来玩Play框架03 模板
因无法找到可行的业务路径,Kitty Hawk关停早期飞行汽车项目
外媒报道称,电动飞机制造商Kitty Hawk近日宣布,在了解了所需的一切后,他们将逐步结束Flyer项目,这是他们最早的一个项目。此前,该公司曾得到谷歌联合创始人拉里·佩奇(Larry Page)的投资。
镁客网
2020/06/10
4300

相似问题

Play框架和Java版本

23

如何更改play框架依赖项版本

13

如何正确地将Angular从版本10更新到版本11?

183

在将macOS更新到Catalina之后,Play框架无法工作

17

将play服务更新到8.3.0后,无法创建发布版本

21
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档