将项目升级到 Scala 2.13:JavaConversions 不是集合集合的成员

Vad*_*dim 4 scala maven twirl

我想将多模块 Maven 项目中的 Scala 版本从 2.11 升级到 2.13。我更改了pom.xml中的所有Scala版本和Scala后缀版本,更新了依赖版本。我在编译中遇到下一个错误:

 \target\generated-sources\twirl\txt\template.template.scala:12: object JavaConversions is not a member of package collection
Run Code Online (Sandbox Code Playgroud)

在目标文件夹中,我找到了旋转模板的编译对象:

import _root_.play.twirl.api.JavaScript
import _root_.play.twirl.api.Xml
....
import scala.collection.JavaConversions._
import scala.collection.JavaConverters._

object analyze_template extends _root_.play.twirl.api.BaseScalaTemplate[pla
Run Code Online (Sandbox Code Playgroud)

来自旋转模板:

@(sourceIncrementName: String, sourceSnapshotName: String)
Run Code Online (Sandbox Code Playgroud)

你能告诉我如何解决吗?

在 Maven 中,我有 scala-maven-plugin 和 twirl 插件:

            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jvmArgs>
                        <jvmArg>-Xms128m</jvmArg>
                        <jvmArg>-Xmx1024m</jvmArg>
                        <jvmArg>-XX:MaxPermSize=512m</jvmArg>
                    </jvmArgs>
                    <args>
                        <arg>-unchecked</arg>
                        <arg>-deprecation</arg>
                        <arg>-explaintypes</arg>
                        <arg>-feature</arg>
                        <arg>-language:implicitConversions</arg>
                    </args>
                    <recompileMode>incremental</recompileMode>
                    <scalaVersion>2.13</scalaVersion>
                </configuration>
            </plugin>
       <plugin>
           <groupId>com.jakewharton.twirl</groupId>
           <artifactId>twirl-maven-plugin</artifactId>
           <version>1.1.0</version>
           <executions>
               <execution>
                   <phase>generate-sources</phase>
                   <goals>
                       <goal>compile</goal>
                   </goals>
               </execution>
           </executions>
       </plugin>
Run Code Online (Sandbox Code Playgroud)

并旋转依赖:

    <dependency>
        <groupId>com.typesafe.play</groupId>
        <artifactId>twirl-api_2.13</artifactId>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

Yay*_*ule 5

从 Scala 2.13 开始, scala.collection包中的对象JavaConverters已被弃用。从今以后你必须使用scala.jdk.CollectionConverters您可以在这里找到完整的文档