spring下载问题总结

3天,整了三天终于可以跑了!

总结一下:

java版本:jdk11

编辑器:2020.3.6(2020版的都可以主要解决kotline的问题版本对应)

spring源码:5.1.x

gradle:6.5.1

步骤:

1、先进入github然后通过spring找到spring project/springframework,复制git地址

2、打开idea从git上把spring源码版本5.1下载下来(经常进不去很烦!!!)

采用git clone -b https://github.com/spring-projects/spring-framework.git的方式GitHub - spring-projects/spring-framework: Spring FrameworkSpring Framework. Contribute to spring-projects/spring-framework development by creating an account on GitHub.https://github.com/spring-projects/spring-framework.git/

3、导入源码很多种方式:我是采用这种方式:

然后选择你下载的路径导入就可以了。

接着就会出现各种问题。。。。

先参考着这篇博客安装:

程序包jdk.jfr.Category不存在,import jdk.jfr.category_Satayia的博客-CSDN博客Spring源码编译一次性通过&遇到的坑解决方法_冰慧的博客-CSDN博客

4、打开build.gradle根据要求下载gradle:我下载的版本是6.5.1(登陆官网就可以,然后找到指定版本),这是地址:Gradle | Releases

5、为什么一定要2020版的idea呢?因为我之前是2019版。。一直报kotlin的错,不能在1.3.3-1.4.0-rc之间选择。。。

排错思路:

1、是kotlin版本设置问题?修改build.gradle中的版本,错误依然存在

2、是maven依赖版本不对?修改版本和1.3.61对应仍然存在错误

3、提高kotlin版本,即安装2020版idea。然后重新导入项目配置其版本为1.4.10解决

下载后安装并添加到环境变量。

6、如果出现reactor和rsocket报401未授权的错误则进行替换(在build.gradle文件中):

			//mavenBom "io.rsocket:rsocket-bom:1.1.0-SNAPSHOT"
			mavenBom "io.rsocket:rsocket-bom:1.1.0"

7、至于导包增加maven管理看着上面那篇博客就行,感觉那个博主还是写的很好的。

运行结果:

> Task :buildSrc:compileJava UP-TO-DATE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:pluginDescriptors UP-TO-DATE
> Task :buildSrc:processResources UP-TO-DATE
> Task :buildSrc:classes UP-TO-DATE
> Task :buildSrc:jar UP-TO-DATE
> Task :buildSrc:assemble UP-TO-DATE
> Task :buildSrc:pluginUnderTestMetadata UP-TO-DATE
> Task :buildSrc:compileTestJava NO-SOURCE
> Task :buildSrc:compileTestGroovy NO-SOURCE
> Task :buildSrc:processTestResources NO-SOURCE
> Task :buildSrc:testClasses UP-TO-DATE
> Task :buildSrc:test NO-SOURCE
> Task :buildSrc:validatePlugins UP-TO-DATE
> Task :buildSrc:check UP-TO-DATE
> Task :buildSrc:build UP-TO-DATE

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE SUCCESSFUL in 37s

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings

8、如果你的jdk是1.8那么问题来了在你compileTestJava时会发现没有jfr包,解决办法就是升级到jdk11,

 然后在包结构中设置为11

9、继续测试,因为有些包过期了所以测试编译不能通过,就是这个类。

public class MonoToListenableFutureAdapter<T> implements ListenableFuture<T> {

	private final MonoProcessor<T> processor;

	private final ListenableFutureCallbackRegistry<T> registry = new ListenableFutureCallbackRegistry<>();


	public MonoToListenableFutureAdapter(Mono<T> mono) {
		Assert.notNull(mono, "Mono must not be null");
		this.processor = mono
				.doOnSuccess(this.registry::success)
				.doOnError(this.registry::failure)
				.toProcessor();
	}


	@Override
	@Nullable
	public T get() {
		return this.processor.block();
	}

	@Override
	@Nullable
	public T get(long timeout, TimeUnit unit) {
		Assert.notNull(unit, "TimeUnit must not be null");
		Duration duration = Duration.ofMillis(TimeUnit.MILLISECONDS.convert(timeout, unit));
		return this.processor.block(duration);
	}

	@Override
	public boolean cancel(boolean mayInterruptIfRunning) {
		if (isCancelled()) {
			return false;
		}
		this.processor.cancel();
		// isCancelled may still return false, if mono completed before the cancel
		return this.processor.isCancelled();
	}

	@Override
	public boolean isCancelled() {
		return this.processor.isCancelled();
	}

	@Override
	public boolean isDone() {
		return this.processor.isTerminated();
	}

	@Override
	public void addCallback(ListenableFutureCallback<? super T> callback) {
		this.registry.addCallback(callback);
	}

	@Override
	public void addCallback(SuccessCallback<? super T> success, FailureCallback failure) {
		this.registry.addSuccessCallback(success);
		this.registry.addFailureCallback(failure);
	}

}

解决办法:注释掉,"-Werror",虽然还会报错但是编译能通过

public class CompilerConventionsPlugin implements Plugin<Project> {

	/**
	 * The project property that can be used to switch the Java source
	 * compatibility version for building source and test classes.
	 */
	public static final String JAVA_SOURCE_VERSION_PROPERTY = "javaSourceVersion";

	public static final JavaVersion DEFAULT_COMPILER_VERSION = JavaVersion.VERSION_1_8;

	private static final List<String> COMPILER_ARGS;

	private static final List<String> TEST_COMPILER_ARGS;

	static {
		List<String> commonCompilerArgs = Arrays.asList(
				"-Xlint:serial", "-Xlint:cast", "-Xlint:classfile", "-Xlint:dep-ann",
				"-Xlint:divzero", "-Xlint:empty", "-Xlint:finally", "-Xlint:overrides",
				"-Xlint:path", "-Xlint:processing", "-Xlint:static", "-Xlint:try", "-Xlint:-options"
		);
		COMPILER_ARGS = new ArrayList<>();
		COMPILER_ARGS.addAll(commonCompilerArgs);
		COMPILER_ARGS.addAll(Arrays.asList(
				"-Xlint:varargs", "-Xlint:fallthrough", "-Xlint:rawtypes", "-Xlint:deprecation",
				"-Xlint:unchecked" /**,"-Werror"**/
		));
		TEST_COMPILER_ARGS = new ArrayList<>();
		TEST_COMPILER_ARGS.addAll(commonCompilerArgs);
		TEST_COMPILER_ARGS.addAll(Arrays.asList("-Xlint:-varargs", "-Xlint:-fallthrough", "-Xlint:-rawtypes",
				"-Xlint:-deprecation", "-Xlint:-unchecked", "-parameters"));
	}
...

最后结果:终于over!

> Task :spring-orm:compileJava
> Task :spring-orm:classes
> Task :spring-orm:jar
> Task :spring-orm:compileTestFixturesJava NO-SOURCE
> Task :spring-orm:compileTestJava

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 3m 56s
63 actionable tasks: 50 executed, 13 up-to-date
16:39:17: Task execution finished 'compileTestJava'.

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]:要下载Spring 6,首先需要进入Spring官网,可以通过地址spring.io或者spring.p2hp.com进入。在官网上可以找到Spring Framework以及其他衍生的框架。对于Spring Framework的下载,可以通过以下步骤进行:首先进入github,然后根据需要选择下载路径,下载相关版本的jar包。此外,还需要下载一个log文件,可以在http://commons.apache.org/logging进行下载。\[1\]\[2\] 引用\[3\]:如果只需要使用Spring的IoC功能,只需引入spring-context这个jar包,并将其添加到classpath中。如果使用Maven,只需引入context的依赖即可。在pom.xml文件中添加以下代码即可完成依赖的引入: ```xml <repositories> <repository> <id>repository.spring.milestone</id> <name>Spring Milestone Repository</name> <url>https://repo.spring.io/milestone</url> </repository> </repositories> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>6.0.0-M2</version> </dependency> </dependencies> ``` 这样就可以完成Spring 6的下载和引入。\[3\] 总结起来,要下载Spring 6,可以通过官网或者github进行下载,并根据需要选择相应的jar包进行下载。同时,还需要注意引入相关的依赖。 #### 引用[.reference_title] - *1* [spring下载,Apache-log下载,以及spring项目的安装和测试](https://blog.csdn.net/qq_46199553/article/details/119008458)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Spring6框架入门到高级(三)Spring的入门程序](https://blog.csdn.net/2301_76637874/article/details/130618111)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值