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

Spring 源码调试问题 ( List.of(“bin“, “build“, “out“); )

Spring 源码调试问题

文章目录

  • `Spring` 源码调试问题
    • 一、问题描述
    • 二、解决方案

一、问题描述

错误:springframework\buildSrc\src\main\java\org\springframework\build\CheckstyleConventions.java:68: 错误: 找不到符号
List<String> buildFolders = List.of("bin", "build", "out");
^
符号:方法 of(java.lang.String,java.lang.String,java.lang.String)

位置:接口 java.util.List

源码错误文件如下

/** Copyright 2002-2024 the original author or authors.** Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at**      https://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/package org.springframework.build;import java.io.File;
import java.nio.file.Path;
import java.util.List;import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
import io.spring.nohttp.gradle.NoHttpExtension;
import io.spring.nohttp.gradle.NoHttpPlugin;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.DependencySet;
import org.gradle.api.plugins.JavaBasePlugin;
import org.gradle.api.plugins.quality.Checkstyle;
import org.gradle.api.plugins.quality.CheckstyleExtension;
import org.gradle.api.plugins.quality.CheckstylePlugin;/*** {@link Plugin} that applies conventions for checkstyle.** @author Brian Clozel*/
public class CheckstyleConventions {/*** Applies the Spring Java Format and Checkstyle plugins with the project conventions.* @param project the current project*/public void apply(Project project) {project.getPlugins().withType(JavaBasePlugin.class, (java) -> {if (project.getRootProject() == project) {configureNoHttpPlugin(project);}project.getPlugins().apply(CheckstylePlugin.class);project.getTasks().withType(Checkstyle.class).forEach(checkstyle -> checkstyle.getMaxHeapSize().set("1g"));CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);checkstyle.setToolVersion("10.14.2");checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();checkstyleDependencies.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));});}private static void configureNoHttpPlugin(Project project) {project.getPlugins().apply(NoHttpPlugin.class);NoHttpExtension noHttp = project.getExtensions().getByType(NoHttpExtension.class);noHttp.setAllowlistFile(project.file("src/nohttp/allowlist.lines"));noHttp.getSource().exclude("**/test-output/**", "**/.settings/**","**/.classpath", "**/.project", "**/.gradle/**");List<String> buildFolders = List.of("bin", "build", "out"); // 错误位置project.allprojects(subproject -> {Path rootPath = project.getRootDir().toPath();Path projectPath = rootPath.relativize(subproject.getProjectDir().toPath());for (String buildFolder : buildFolders) {Path innerBuildDir = projectPath.resolve(buildFolder);noHttp.getSource().exclude(innerBuildDir + File.separator + "**");}});}}

二、解决方案

Gradle JVM 版本过低,需要在 Java 8 版本以上,建议 Java 17,因为官方 Spring 版本用的就是 Java 17

Settings 里面的 gradle JVM 配置设置为 Java 17 即可

在这里插入图片描述

http://www.lryc.cn/news/328248.html

相关文章:

  • Centos7安装RTL8111网卡驱动
  • 吉时利KEITHLEY2460数字源表
  • 数据库原理(含思维导图)
  • 数据结构(六)——图
  • Android-AR眼镜屏幕显示
  • 蓝桥集训之货币系统
  • 基于微信小程序的校园服务平台设计与实现(程序+论文)
  • QT+Opencv+yolov5实现监测
  • 【Python-Docx库】Word与Python的完美结合
  • 吴恩达深度学习笔记:浅层神经网络(Shallow neural networks)3.6-3.8
  • 盘点最适合做剧场版的国漫,最后一部有望成为巅峰
  • Altium Designer许可需求分析
  • [c++]类和对象常见题目详解
  • 【c++】类和对象(五)赋值运算符重载
  • 密码学基础-对称密码/公钥密码/混合密码系统 详解
  • 《装饰器模式(极简c++)》
  • Spring Boot 整合分布式搜索引擎 Elastic Search 实现 自动补全功能
  • 实现一个Google身份验证代替短信验证
  • Spring框架与Spring Boot的区别和联系
  • [OpenCV学习笔记]Qt+OpenCV实现图像灰度反转、对数变换和伽马变换
  • 【大数据】Flink学习笔记
  • 社交网络的未来:Facebook如何塑造数字社交的下一章
  • RabbitMQ 延时消息实现
  • 【Django】枚举类型数据
  • java实现https连接总是要报no cipher suites in common
  • [C++初阶] 爱上C++ : 与C++的第一次约会
  • STM32技术打造:智能考勤打卡系统 | 刷卡式上下班签到自动化解决方案
  • module ‘numpy‘ has no attribute ‘int‘
  • MFC(一)搭建空项目
  • OKCC的API资源管理平台怎么用?