1
+ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2
+
1
3
plugins {
2
4
id ' org.springframework.restdocs.conventions'
3
5
id " java-library"
4
6
id " java-test-fixtures"
5
7
id " maven-publish"
6
8
id " org.springframework.restdocs.optional-dependencies"
9
+ id " com.gradleup.shadow" version " 8.3.8" apply false
7
10
}
8
11
9
12
description = " Spring REST Docs Core"
10
13
11
14
configurations {
12
- jarjar
13
15
jmustache
14
16
testArtifacts. extendsFrom testRuntime
15
17
}
16
18
17
- task jmustacheRepackJar (type : Jar ) { repackJar ->
18
- repackJar. archiveBaseName = " restdocs-jmustache-repack"
19
- repackJar. archiveVersion = jmustacheVersion
20
-
21
- doLast() {
22
- ant {
23
- taskdef name : " jarjar" , classname : " com.tonicsystems.jarjar.JarJarTask" ,
24
- classpath : configurations. jarjar. asPath
25
- jarjar(destfile : repackJar. archiveFile. get()) {
26
- configurations. jmustache. each { originalJar ->
27
- zipfileset(src : originalJar, includes : " **/*.class" )
28
- }
29
- rule(pattern : " com.samskivert.**" , result : " org.springframework.restdocs.@1" )
30
- }
31
- }
32
- }
19
+ def jmustacheShadowJar = tasks. register(" jmustacheShadowJar" , ShadowJar ) {
20
+ archiveBaseName = " restdocs-jmustache"
21
+ archiveVersion = jmustacheVersion
22
+ configurations = [ project. configurations. jmustache ]
23
+ include(" *.jar" )
24
+ include(" com/samskivert/**/*.class" )
25
+ relocate(" com.samskivert" , " org.springframework.restdocs" )
33
26
}
34
27
35
28
dependencies {
36
29
compileOnly(" org.apiguardian:apiguardian-api" )
37
30
38
31
implementation(" com.fasterxml.jackson.core:jackson-databind" )
39
32
implementation(" org.springframework:spring-web" )
40
- implementation(files(jmustacheRepackJar))
41
-
42
- jarjar(" com.googlecode.jarjar:jarjar:1.3" )
33
+ implementation(files(jmustacheShadowJar))
43
34
44
35
jmustache(platform(project(" :spring-restdocs-platform" )))
45
36
jmustache(" com.samskivert:jmustache@jar" )
@@ -56,7 +47,7 @@ dependencies {
56
47
57
48
testFixturesCompileOnly(" org.apiguardian:apiguardian-api" )
58
49
59
- testFixturesImplementation(files(jmustacheRepackJar ))
50
+ testFixturesImplementation(files(jmustacheShadowJar ))
60
51
testFixturesImplementation(" org.hamcrest:hamcrest-library" )
61
52
testFixturesImplementation(" org.mockito:mockito-core" )
62
53
testFixturesImplementation(" org.springframework:spring-core" )
@@ -75,9 +66,15 @@ dependencies {
75
66
testRuntimeOnly(" org.junit.platform:junit-platform-engine" )
76
67
}
77
68
78
- jar {
79
- dependsOn jmustacheRepackJar
80
- from(zipTree(jmustacheRepackJar . archiveFile . get() )) {
69
+ tasks . named( " jar" ) {
70
+ dependsOn jmustacheShadowJar
71
+ from(zipTree(jmustacheShadowJar . map { it . archiveFile } )) {
81
72
include " org/springframework/restdocs/**"
82
73
}
83
74
}
75
+
76
+ tasks. named(" javadoc" ) {
77
+ doFirst {
78
+ println classpath
79
+ }
80
+ }
0 commit comments