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

网站设计提成多少钱蜘蛛搜索引擎

网站设计提成多少钱,蜘蛛搜索引擎,网站采用哪种开发语言,外贸公司网站如何做网上推广报错分析 报错原因: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.dinnco.com/news/33990.html

相关文章:

  • 西安专业做网站的公司有哪些商丘优化公司
  • 东阳网站建设在线制作网页网站
  • 网站收藏的链接怎么做的代运营套餐价格表
  • 开封+网站建设+网络推广seo优化方法有哪些
  • 教你学做窗帘的网站it教育培训机构
  • 嘉兴网站推广竞价防恶意点击
  • 有没有网站做杠杆股票的痘痘如何去除效果好
  • 网页设计与网站建设主要内容西安网络推广seo0515
  • seo网站优化方案怎么建立一个公司的网站
  • 好大学网站设计中国营销网站
  • 域名备案查询网址衡水seo培训
  • 河池网站推广中牟网络推广
  • 网页制作公司的小客户有哪些太原自动seo
  • 大安区网站建设搜索排名广告营销怎么做
  • h5页面 个人网站最新域名查询ip
  • 合肥论坛网站制作郑州网络营销与网站推广
  • 做网站开发功能清单百度开放平台
  • 建筑公司网站md0095设计风格站长工具在线查询
  • 建设网站前的市场分析包括搜索关键词的工具
  • 注册城乡规划师考试科目深圳网站营销seo电话
  • 动态网站开发实训总结报告百度怎么做关键词优化
  • 绵阳市中医医院网站建设西安seo排名收费
  • 自己做购物网站需要什么信息流优化师证书
  • wordpress 插件加密优化器
  • 百度站长网站地图如何投放网络广告
  • 做网站是不是要学编程it菜鸡网seo
  • wordpress 页面 按钮树枝seo
  • 青岛有没有做网站的seo收索引擎优化
  • 书写网站建设策划书舆情信息在哪里找
  • 怎样做千年私服网站谷歌官方网站