TongchengOpenSource / smart-doc

Smart-doc is a java restful api document generation tool. Smart-doc is based on interface source code analysis to generate interface documentation, completely zero-injection.
https://smart-doc-group.github.io/#/
Apache License 2.0
1.41k stars 277 forks source link

Gradle plugin causes an error when introduced according to the documentation. #276

Closed zhangjiayu139 closed 2 years ago

zhangjiayu139 commented 2 years ago

Your Environment(您的使用环境)

Expected Behavior(您期望的结果)

Spring Boot 2.6.8 + Gradle integration with smart-doc causes an error. Integration code: ` buildscript { repositories { maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } maven { url = uri("https://plugins.gradle.org/m2/") } mavenCentral() } dependencies { classpath 'com.github.shalousun:smart-doc-gradle-plugin:2.4.5' } } apply(plugin = "com.github.shalousun.smart-doc")

plugins { id 'org.springframework.boot' version '2.6.8' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id "com.github.shalousun.smart-doc" version "2.4.5" id 'java' }

group = 'com.study' version = '0.0.1-SNAPSHOT' sourceCompatibility = '1.8'

configurations { compileOnly { extendsFrom annotationProcessor } }

repositories { mavenCentral() }

dependencies { //security implementation 'org.springframework.boot:spring-boot-starter-security' // jjwt implementation 'io.jsonwebtoken:jjwt:0.9.1' implementation 'org.springframework.boot:spring-boot-starter-web' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' annotationProcessor 'org.projectlombok:lombok' //druid mysql connection pool implementation 'com.alibaba:druid-spring-boot-starter:1.2.3' //mysql runtimeOnly 'mysql:mysql-connector-java:5.1.40' //mybatis-plus implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.1' //mapStruct implementation 'org.mapstruct:mapstruct:1.4.2.Final' annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' // redis implementation 'org.springframework.boot:spring-boot-starter-data-redis' //common-lang3 implementation 'org.apache.commons:commons-lang3:3.12.0' //hutool implementation 'cn.hutool:hutool-all:5.8.1' // fastjson implementation 'com.alibaba:fastjson:1.2.83' //smart-doc testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' }

smartdoc { configFile = file("src/main/resources/smart-doc.json")

// exclude example
// exclude artifact
exclude 'org.springframework.boot:spring-boot-starter-tomcat'
// exclude artifact use pattern
exclude 'org.springframework.boot.*'
// You can use the include configuration to let the plugin automatically load the specified source.
// include example
include 'org.springframework.boot:spring-boot-starter-tomcat'
// 使用jpa的分页
include 'org.springframework.data:spring-data-commons'
// 使用mybatis-plus的分页
include 'com.baomidou:mybatis-plus-extension'

} tasks.named('test') { useJUnitPlatform() } `

Current Behavior(当前结果)

error: A problem occurred configuring root project 'authDemo'.

Could not resolve all dependencies for configuration ':classpath'. Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.4.1/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.

Possible Solution(bug解决建议)

Steps to Reproduce (Bug产生步骤,请尽量提供用例代码)

1. 2. 3. 4.

Context(Bug影响描述)

shalousun commented 2 years ago

@zhangjiayu139 Your issue is due to a conflict between your configuration and a higher version of Gradle. The official documentation might be based on Gradle 7.x, which does not support the use of HTTP protocol in maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } with higher versions; HTTPS is required.

shalousun commented 2 years ago

@zhangjiayu139 https://smart-doc-group.github.io/#/zh-cn/plugins/gradle_plugin?id=introduce