How to construct a fat container with multi-project and Gradle?
已回答
I'm new to Gradle, and is battling with building a multi-projects fat container.
I'm attempting to do likewise as referenced here: Gradle numerous containers from single source envelope
I have three bundles, the reliance is: PandaService => PandaServiceDataAccessLayer => PandaDatabaseDocker.
Presently I need to construct a fat container for PandaService. Be that as it may, I'm not ready to get ./gradlew fabricate work. Presently it is griping that Module with id 'org.springframework.boot' not found. How might I fix it?
Will likewise see the value in any prompts on changing build.gradle to follow the prescribed procedures.
More Data
This is the settings.gradle of PandaService:
rootProject.name = "PandaService"
include "PandaService"
include "PandaDatabaseDocker"
include "PandaServiceDataAccessLayer"
This is the build.gradle
of PandaService
:
subprojects {
apply plugin: 'java'
}
project(':PandaDatabaseDocker') {
sourceSets {
main {
java {
srcDir '../src'
include 'PandaDatabaseDocker/**'
}
}
}
}
project(':PandaServiceDataAccessLayer') {
sourceSets {
main {
java {
srcDir '../src'
include 'PandaServiceDataAccessLayer/**'
}
}
}
dependencies {
implementation project(':PandaDatabaseDocker')
}
}
project(':PandaService') {
repositories {
mavenCentral()
}
group = 'PandaService'
version = '0.0.1'
sourceCompatibility = '11'
targetCompatibility = '11'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceSets {
main {
java {
srcDir '../src'
include 'PandaService/**'
}
}
}
dependencies {
// Add depended local modules
implementation project(':PandaServiceDataAccessLayer')
// Spring boot + Jersey
implementation 'org.springframework.boot:spring-boot-starter-parent:2.6.4'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-jersey'
compileOnly("org.springframework.boot:spring-boot-devtools")
testImplementation 'org.springframework.boot:spring-boot-starter-test'
// Swagger
implementation 'io.swagger:swagger-jersey2-jaxrs:1.6.5'
// Lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// log
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
// RDS Connection
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'mysql:mysql-connector-java:8.0.27'
// AWS secretes manager
implementation 'com.amazonaws.secretsmanager:aws-secretsmanager-jdbc:1.0.6'
// JOOQ
implementation 'org.springframework.boot:spring-boot-starter-jooq'
// HikariCP
implementation 'com.zaxxer:HikariCP:5.0.1'
}
//create a fat Jar with all dependencies
jar {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
dependsOn configurations.runtimeClasspath
from {
configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest {
attributes "Main-Class": "com.PandaService.MainApplication"
}
}
configurations {
all*.exclude module: 'spring-boot-starter-logging'
all*.exclude module: "logback-classic"
compileOnly {
extendsFrom annotationProcessor
}
}
test {
useJUnitPlatform()
}
}
请先登录再写评论。
Hello,
Is it possible to attach sample project example for investigation?