-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
83 lines (70 loc) · 2.41 KB
/
build.gradle
File metadata and controls
83 lines (70 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.1'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'com.main'
version = '0.0.1-SNAPSHOT'
description = 'Payment Adapter Middleware Service'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webmvc'
implementation 'org.springframework.boot:spring-boot-starter-webservices'
implementation 'wsdl4j:wsdl4j' // Required to generate the WSDL automatically
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.2'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.5'
implementation 'org.glassfish.jaxb:jaxb-xjc:4.0.5' // For Java 21 compatibility and code generation
developmentOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
testImplementation 'org.springframework.boot:spring-boot-starter-webservices-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
// Configure directories for generated sources
def generatedSourcesDir = file("${buildDir}/generated-sources/jaxb")
def javaSourceDir = file("src/main/java")
// JAXB code generation task
task generateJaxb(type: Exec) {
description = 'Generates Java classes from XSD schemas'
group = 'build'
inputs.files fileTree('src/main/resources/soap-contracts').include('**/*.xsd')
outputs.dir generatedSourcesDir
doFirst {
generatedSourcesDir.mkdirs()
// Clean existing generated files in src/main/java
delete fileTree(javaSourceDir).matching {
include 'api/soap/**/*.java'
}
}
commandLine 'java', '-classpath', configurations.runtimeClasspath.asPath,
'com.sun.tools.xjc.XJCFacade',
'-d', javaSourceDir.absolutePath,
'-p', 'api.soap.hello',
'src/main/resources/soap-contracts/hello.xsd'
}
// Add generated sources to source sets
sourceSets {
main {
java {
srcDir generatedSourcesDir
}
}
}
// Make compileJava depend on JAXB generation
compileJava.dependsOn generateJaxb
// Configure clean task to remove generated files
clean {
delete fileTree(javaSourceDir).matching {
include 'api/soap/**/*.java'
}
delete generatedSourcesDir
}
tasks.named('test') {
useJUnitPlatform()
}