当前位置:   article > 正文

spring源码导入_id 'com.gradle.build-scan' version '3.2

id 'com.gradle.build-scan' version '3.2

构建过两次spring的源码,第一次很顺利就完成了,第二次倒是遇到了不少问题。记录一下

需要注意的几点:

  • gradle的版本选择,需要跟下载的spring源码对应,具体在gradle/wrapper/gradle-wrapper.properties
    的distributionUrl中指出 distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
    gradle版本一开始我选择的是6.0.11版本,在build的时候由于gradle版本太高,id 'com.gradle.build-scan' version '3.2'这个插件无法下载
    还有需要注意idea版本和gradle版本的兼容性,亲测2018版的idea不兼容gradle 5.6,而spring 5.2.8版本的编译又要求gradle版本不低于5.6,后来我升级idea到2020才没有问题
  • build的过程中,遇到了以下错误
Build file 'F:\idea_code\enjoy\spring源码相关\spring-source-5.2.8\build.gradle' line: 6

Error resolving plugin [id: 'io.spring.gradle-enterprise-conventions', version: '0.0.2']
> Could not resolve all dependencies for configuration 'detachedConfiguration5'.
   > Could not determine artifacts for io.spring.gradle-enterprise-conventions:io.spring.gradle-enterprise-conventions.gradle.plugin:0.0.2
      > Could not get resource 'https://repo.spring.io/plugins-release/io/spring/gradle-enterprise-conventions/io.spring.gradle-enterprise-conventions.gradle.plugin/0.0.2/io.spring.gradle-enterprise-conventions.gradle.plugin-0.0.2.jar'.
         > Could not HEAD 'https://repo.spring.io/plugins-release/io/spring/gradle-enterprise-conventions/io.spring.gradle-enterprise-conventions.gradle.plugin/0.0.2/io.spring.gradle-enterprise-conventions.gradle.plugin-0.0.2.jar'. Received status code 401 from server: Unauthorized

 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

不知道什么时候开始,从spring的官网仓库下载包或插件需要认证了,这里很明显的一个灭有授权的错误401,但是此时我的build.gradle以及setting.gradle是这样配置的:

	repositories {
			maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
			maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter'}
			mavenCentral()
			jcenter()
			google()
			maven { url "https://repo.spring.io/libs-spring-framework-build" }
		}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
	repositories {
		gradlePluginPortal()
		maven { url 'https://maven.aliyun.com/repository/public' }
		maven { url 'https://repo.spring.io/plugins-release' }
	}
	
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

我已经加了阿里云的源,但似乎不起作用,还是首先去spring官网去加载,于是我只好先把spring的源注释掉,只保留阿里云的。这样开始下一步执行gradlew :spring-oxm:compileTestJava
先编译spring-oxm模块。编译成功之后,再导入到idea中点击build做全局编译。

  • 此时还有一个问题,build.gradle中有个插件无法下载
plugins {
	id 'io.spring.dependency-management' version '1.0.8.RELEASE' apply false
	id 'org.jetbrains.kotlin.jvm' version '1.3.72' apply false
	id 'org.jetbrains.dokka' version '0.10.1' apply false
	id 'org.asciidoctor.jvm.convert' version '2.4.0'
//	id 'io.spring.gradle-enterprise-conventions' version '0.0.2'
	id 'io.spring.nohttp' version '0.0.5.RELEASE'
	id 'de.undercouch.download' version '4.0.0'
	id 'com.gradle.build-scan' version '3.2'
	id "com.jfrog.artifactory" version '4.12.0' apply false
	id "io.freefair.aspectj" version '4.1.1' apply false
	id "com.github.ben-manes.versions" version '0.24.0'
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

就是注释掉的那个id ‘io.spring.gradle-enterprise-conventions’ version ‘0.0.2’,可以先注释掉

  • plugin with id ‘java-test-fixtures‘ not found
    gradle版本要求在5.6.4-6.0之间

  • 这时候大部分模块都编译好了,只剩下一个spring-tx包,它依赖了一个包我这里找不到资源,

Could not find com.ibm.websphere:uow:6.0.2.17.
Required by:
    project :spring-tx

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

这时候可以再把前面注释掉的spring官网的源给放开,就下载下来了。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/305807
推荐阅读
相关标签
  

闽ICP备14008679号