zoukankan      html  css  js  c++  java
  • Static methods in interface require -target:jvm-1.8 Web3j.build(httpService)

    使用web3j构建项目时,提示如下错误:

    Error:(21, 16) Static methods in interface require -target:jvm-1.8
        Web3j.build(httpService)

     在idea中选择scala编译时,带上参数-target:jvm-1.8

    或者在pom文件中

    1) 如果使用 maven-scala-plugin 这个插件编译的,则如下 <arg>-target:jvm-1.8</arg>

     <plugin>
                    <groupId>org.scala-tools</groupId>
                    <artifactId>maven-scala-plugin</artifactId>
                    <version>2.15.2</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <scalaVersion>${scala.version}</scalaVersion>
                        <args>
                            <arg>-target:jvm-1.8</arg>
                        </args>
                    </configuration>
                </plugin>

    2)如果使用的是 scala-maven-plugin,则添加的是 <addScalacArgs>-target:jvm-1.8</addScalacArgs>

                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>4.5.3</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <scalaVersion>${scala.version}</scalaVersion>
                        <addScalacArgs>-target:jvm-1.8</addScalacArgs>
                    </configuration>
                </plugin>
    作者:尤灯塔
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
  • 相关阅读:
    POJ--2356 Find a multiple
    Trailing Zeroes (III)
    第一章 快速入门
    第二章 变量和基本类型
    第三章 标准库类型
    第四章 数组和指针
    第五章 表达式
    第六章 语句
    第七章 函数
    第八章 标准IO库
  • 原文地址:https://www.cnblogs.com/30go/p/15049040.html
Copyright © 2011-2022 走看看