programing

스프링 부트 그래들 플러그인을 찾을 수 없습니다.

newnotes 2023. 4. 5. 22:13
반응형

스프링 부트 그래들 플러그인을 찾을 수 없습니다.

스프링 부트 플러그인을 추가하는 그래들스크립트가 따로 있어요다음과 같습니다.

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url 'http://repo.spring.io/libs-release' }
    }
    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.1.8.RELEASE'
    }
}

apply plugin: 'spring-boot'

그런 다음 다른 프로젝트에서는 다음과 같이 참조됩니다.

apply from: '../../food-orders-online-main/spring-boot.gradle'

빌드 태스크를 실행하면 다음 오류가 나타납니다.

A problem occurred evaluating script.
> Failed to apply plugin [id 'spring-boot']
> Plugin with id 'spring-boot' not found.

내가 뭘 잘못하고 있는지 아는 사람?

스크립트 플러그인에서는 플러그인 ID별 플러그인 적용이 지원되지 않습니다.플러그인의 정규화된 클래스 이름을 사용해야 합니다.

apply plugin: org.springframework.boot.gradle.plugin.SpringBootPlugin

자세한 내용은 이 스레드를 참조하십시오.

업데이트: 플러그인 클래스 이름을 업데이트하는 중입니다.

스프링 부트 2.0.1에서 사용하는 플러그인은 다음과 같습니다.

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

여기에 있는 완전한 바닐라 그라들 파일(스프링 부츠 2.0.5)

buildscript {
    ext {
        springBootVersion = '2.0.5.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

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

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

또는

더 좋은 옵션이 있습니다.스프링 스타터(스프링 부트 템플릿 생성 도구) start.spring.io에 접속하여 템플릿 프로젝트를 생성하고 거기에서 단계별로 빌드합니다.

이 코드를 사용할 수 있습니다.

 plugins{

  id 'org.springframework.boot' version '2.0.3.RELEASE'

 }
  1. 추가:

    buildscript {
        repositories {
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
        dependencies {
            classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.4.RELEASE"
        }}
    
  2. 변경:

    apply plugin: 'spring-boot'
    

    대상:

    apply plugin: "org.springframework.boot"
    

SpringBoot 1.4.0 이후릴리스 플러그인 패키지가 약간 변경되었습니다.

apply plugin: org.springframework.boot.gradle.plugin.SpringBootPlugin

구문을 확인하고 괄호가 닫히는 위치를 확인합니다.}같은 문제가 발생했는데 내 저장소 {}가 포함되지 않았습니다.}마지막에

유사한 예외가 있다.

Caused by: org.gradle.internal.resolve.ArtifactNotFoundException: Could not find spring-boot-gradle-plugin-3.0.0-SNAPSHOT.jar (org.springframework.boot:spring-boot-gradle-plugin:3.0.0-SNAPSHOT:20220216.230329-214)

gradle 빌드를 --refresh-dependencies를 수정하여 실행하면

아래 코드가 유효합니다.-

buildscript {
ext { springBootVersion = '2.0.5.RELEASE'}
repositories { mavenCentral() }
dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

group 'com.example'
version '1.0-SNAPSHOT'

repositories {
mavenCentral()
}


dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot- 
starter-web', version: '2.0.5.RELEASE'
}

프록시 설정(조직 내 프록시 IP란 무엇인가) 후 build.gradle 파일에 다음 코드를 추가하였습니다.문제는 해결되었다.

sourceSets {
main {
    output.setResourcesDir(java.outputDir)
   }
}

2020년 7월 1일 현재, 이렇게 설정할 수 있었고, 작동했습니다!이것이 이 문제에 직면한 모든 사람에게 도움이 되기를 바랍니다.주의: 버전에 주의해 주세요.

buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath('org.springframework.boot:spring-boot-gradle-plugin:2.2.8.RELEASE')
        }
    }
    
    plugins {
        id 'org.springframework.boot' version '2.2.8.RELEASE'
        id 'java'
    }
    
    group 'org.capfer'
    version '1.0-SNAPSHOT'
    
    sourceCompatibility = 1.8
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testCompile group: 'junit', name: 'junit', version: '4.12'
        compile('org.springframework.boot:spring-boot-starter-web:2.2.8.RELEASE')
    }

클래스 패스에 메인(String[]메인)이 있는 @SpringBootApplication이 없을 수 있습니다.

언급URL : https://stackoverflow.com/questions/26577805/spring-boot-gradle-plugin-cant-be-found

반응형