Мой каталог:
Код: Выделить всё
root:
|-> services
|-> gateway
|-> (under the normal folder structure) GatewayApplication.java (Where my @SpringBootApplication is)
|-> build.gradle
|-> userService
|-> UserServiceApplication.java (Where my @SpringBootApplication is)
|-> build.gradle
|-> build.gradle (the gradle file in question)
|-> (root's) build.gradle
|-> settings.gradle
Код: Выделить всё
rootProject.name = 'black-creek'
// I thought that these would dictate that it where these directories, gateway and userService where the only buildable gradle projects
include 'services:gateway'
include 'services:userService'
Код: Выделить всё
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.0' apply false
id 'io.spring.dependency-management' version '1.1.7' apply false
}
allprojects {
group = 'ciallsoftware'
version = '0.0.1-SNAPSHOT'
}
subprojects {
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
useJUnitPlatform()
}
}
Если бы я не включил build.gradle в корень каталога службы, я бы постоянно получал следующую ошибку:
Код: Выделить всё
./gradlew bR
> Task :services:bootRun FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':services:bootRun'.
> Failed to query the value of task ':services:bootRun' property 'mainClass'.
> Main class name has not been configured and it could not be resolved from classpath
Код: Выделить всё
bootJar {
enabled = false
}
bootRun {
enabled = false
}
jar {
enabled = false
}
Любое объяснение/понимание было бы полезно.>
Подробнее здесь: https://stackoverflow.com/questions/798 ... g-question
Мобильная версия