当前位置: 首页 > news >正文

黑彩网站怎么建设wordpress淘宝客单页主题

黑彩网站怎么建设,wordpress淘宝客单页主题,wordpress开发手册下载地址,福建seo外包报错分析 报错原因:Maven 构建时,Java 版本配置不匹配 我安装的JDK版本是1.8,但由于种种原因,Maven构建时指定了 Java 17 作为目标发行版,从而导致错误 解决方案 首先,java -version,查看环…

报错分析

报错原因:Maven 构建时,Java 版本配置不匹配

我安装的JDK版本是1.8,但由于种种原因,Maven构建时指定了 Java 17 作为目标发行版,从而导致错误

解决方案

首先,java -version,查看环境变量是否设置为了想要的JDK版本

1.检查pom文件

由于是在Maven构建时报错,所以优先检查pom文件,查看是否在properties中设置了错误的compiler.sourcecompiler.target

如上所示则是正确的(因为使用的JDK版本是1.8)

两个参数的含义分别是:

maven.compiler.source设置为 1.8,表示使用 Java 8 的语法规则来编译源代码

maven.compiler.target设置为 1.8,表示生成的字节码版本为 Java 8

2.查看Maven的有效配置

在编译时,可以使用 maven-compiler-plugin 插件指定所使用的JDK的版本,如果没有指定的话,将会使用默认配置,可以通过mvn help:effective-pom指令来查看默认配置,打印输出的内容结构如下:

  <modelVersion>4.0.0</modelVersion><groupId>com.why</groupId><artifactId>Sort-Array-Desc</artifactId><version>1.0-SNAPSHOT</version><properties><maven.compiler.compilerVersion>17</maven.compiler.compilerVersion><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties><dependencies><dependency><groupId>org.apache.hive</groupId><artifactId>hive-exec</artifactId><version>3.1.3</version><scope>compile</scope></dependency></dependencies><repositories><repository><snapshots><enabled>false</enabled></snapshots><id>central</id><name>Central Repository</name><url>https://repo.maven.apache.org/maven2</url></repository></repositories><pluginRepositories><pluginRepository><releases><updatePolicy>never</updatePolicy></releases><snapshots><enabled>false</enabled></snapshots><id>central</id><name>Central Repository</name><url>https://repo.maven.apache.org/maven2</url></pluginRepository></pluginRepositories><build><sourceDirectory>D:\codes\java\hive\Sort-Array-Desc\src\main\java</sourceDirectory><scriptSourceDirectory>D:\codes\java\hive\Sort-Array-Desc\src\main\scripts</scriptSourceDirectory><testSourceDirectory>D:\codes\java\hive\Sort-Array-Desc\src\test\java</testSourceDirectory><outputDirectory>D:\codes\java\hive\Sort-Array-Desc\target\classes</outputDirectory><testOutputDirectory>D:\codes\java\hive\Sort-Array-Desc\target\test-classes</testOutputDirectory><resources><resource><directory>D:\codes\java\hive\Sort-Array-Desc\src\main\resources</directory></resource></resources><testResources><testResource><directory>D:\codes\java\hive\Sort-Array-Desc\src\test\resources</directory></testResource></testResources><directory>D:\codes\java\hive\Sort-Array-Desc\target</directory><finalName>Sort-Array-Desc</finalName><pluginManagement><plugins><plugin><artifactId>maven-antrun-plugin</artifactId><version>1.3</version></plugin><plugin><artifactId>maven-assembly-plugin</artifactId><version>2.2-beta-5</version></plugin><plugin><artifactId>maven-dependency-plugin</artifactId><version>2.8</version></plugin><plugin><artifactId>maven-release-plugin</artifactId><version>2.5.3</version></plugin></plugins></pluginManagement><plugins><plugin><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version><executions><execution><id>default-compile</id><phase>compile</phase><goals><goal>compile</goal></goals><configuration><source>1.8</source><target>1.8</target></configuration></execution><execution><id>default-testCompile</id><phase>test-compile</phase><goals><goal>testCompile</goal></goals><configuration><source>1.8</source><target>1.8</target></configuration></execution></executions><configuration><source>1.8</source><target>1.8</target></configuration></plugin><plugin><artifactId>maven-clean-plugin</artifactId><version>2.5</version><executions><execution><id>default-clean</id><phase>clean</phase><goals><goal>clean</goal></goals></execution></executions></plugin><plugin><artifactId>maven-resources-plugin</artifactId><version>2.6</version><executions><execution><id>default-testResources</id><phase>process-test-resources</phase><goals><goal>testResources</goal></goals></execution><execution><id>default-resources</id><phase>process-resources</phase><goals><goal>resources</goal></goals></execution></executions></plugin><plugin><artifactId>maven-jar-plugin</artifactId><version>2.4</version><executions><execution><id>default-jar</id><phase>package</phase><goals><goal>jar</goal></goals></execution></executions></plugin><plugin><artifactId>maven-surefire-plugin</artifactId><version>2.12.4</version><executions><execution><id>default-test</id><phase>test</phase><goals><goal>test</goal></goals></execution></executions></plugin><plugin><artifactId>maven-install-plugin</artifactId><version>2.4</version><executions><execution><id>default-install</id><phase>install</phase><goals><goal>install</goal></goals></execution></executions></plugin><plugin><artifactId>maven-deploy-plugin</artifactId><version>2.7</version><executions><execution><id>default-deploy</id><phase>deploy</phase><goals><goal>deploy</goal></goals></execution></executions></plugin><plugin><artifactId>maven-site-plugin</artifactId><version>3.3</version><executions><execution><id>default-site</id><phase>site</phase><goals><goal>site</goal></goals><configuration><outputDirectory>D:\codes\java\hive\Sort-Array-Desc\target\site</outputDirectory><reportPlugins><reportPlugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-project-info-reports-plugin</artifactId></reportPlugin></reportPlugins></configuration></execution><execution><id>default-deploy</id><phase>site-deploy</phase><goals><goal>deploy</goal></goals><configuration><outputDirectory>D:\codes\java\hive\Sort-Array-Desc\target\site</outputDirectory><reportPlugins><reportPlugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-project-info-reports-plugin</artifactId></reportPlugin></reportPlugins></configuration></execution></executions><configuration><outputDirectory>D:\codes\java\hive\Sort-Array-Desc\target\site</outputDirectory><reportPlugins><reportPlugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-project-info-reports-plugin</artifactId></reportPlugin></reportPlugins></configuration></plugin></plugins></build><reporting><outputDirectory>D:\codes\java\hive\Sort-Array-Desc\target\site</outputDirectory></reporting>
</project>

可以看到,默认配置中,指定了源代码编译的语法规则以及生成的字节码文件版本都是Java 17,与我们本地的环境不符,因此·会报错:无效的目标发行版17

此时我很奇怪为什么默认会用Java 17的语法去进行编译,于是去查看maven的配置文件settings.xml,结果发现在<profiles></profiles>中添加了一个profile

可能是之前想要控制maven的默认编译行为,结果忘记了😂

所以解决方案有两种,第一种就是删除这里的配置,由于我所使用的maven版本是3.6.3,默认就是用Java 8 进行编译了:

第二种方法就是使用maven-compiler-plugin插件配置:

    <build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version><configuration><source>1.8</source><target>1.8</target></configuration></plugin></plugins></build>

从而覆盖默认的配置

3.检查IDE中的JDK 配置

除了以上Maven配置的问题,我们也需要检查IDE中的配置,下述的方法在运行代码报错时同样可用

3.1 Project Structure

进入File -> Project Structure

Project标签页中,检查 Project SDK 是否设置为 1.8:

Modules 标签页中,检查 Module SDK以及language level是否设置为 1.8:

3.2 Java Compiler

进入File -> Settings -> Java Compiler,检查Target bytecode version是否设置为1…8:

http://www.yayakq.cn/news/734871/

相关文章:

  • 微山网站建设wordpress模板安装后
  • 电子商务网站建设策划书范文网络整合营销六大模型
  • 网站备案密码修改网站建设四网合一
  • 做网站菏泽wordpress 酒主题
  • 怎样做网站和网站的友情链接h5用什么制作
  • 景安网站备案表格为什么说做网站赚钱
  • 登不上建设银行网站百度域名的ip
  • 网站建设相关的比赛网站开发收获
  • 什么是企业营销型网站重庆住建部官网
  • 还能用的wap网站网络建设服务与网站运营推广
  • php网站开发专业介绍wordpress 总变量
  • 杭州市住房与城乡建设部网站网站开发常用的语言和工具
  • 网站内链技巧网络媒体设计是做什么的
  • 做照片书网站好沈阳市网站建设报价
  • 东莞企业网站建设seo教学网seo
  • 百度广州给做网站公司空气净化器用什么网站做外贸
  • 如何让百度快照找到自己的网站最近10条重大新闻
  • 网站内页跳转wap提供商城网站
  • 如何做视频播放网站企业宣传片制作公司天津
  • 被百度收录的网站有哪些东莞网站关键词排名
  • 重庆潼南网站建设企业信息管理系统实训报告
  • 专业建网站平台北京建设网站图片
  • 山东建设厅科技处网站湖北网站建设开发
  • 莱阳建设局网站来年做那个网站致富
  • tp做的网站封装成app微信网页注册入口
  • 网站建设实施计划河北网络公司有哪些
  • 杭州市做网站的公司wordpress头部警告错误
  • 免费建站的软件品牌设计公司网站源码
  • 深圳论坛网站建设4a广告公司什么意思
  • 网站建设后台管理怎么进入网站建设找