@@ -89,10 +89,6 @@ dependencies {
89
89
exclude group : ' xalan' , module : ' xalan'
90
90
exclude group : ' xml-apis' , module : ' xml-apis'
91
91
}
92
- renderImplementation(" org.apache.xmlgraphics:batik-script:${ batikVersion} " ) {
93
- exclude group : ' xalan' , module : ' xalan'
94
- exclude group : ' xml-apis' , module : ' xml-apis'
95
- }
96
92
97
93
rendersignImplementation " org.apache.pdfbox:pdfbox:${ pdfboxVersion} "
98
94
rendersignImplementation " de.rototor.pdfbox:graphics2d:${ graphics2dVersion} "
@@ -109,10 +105,6 @@ dependencies {
109
105
exclude group : ' xalan' , module : ' xalan'
110
106
exclude group : ' xml-apis' , module : ' xml-apis'
111
107
}
112
- rendersignImplementation(" org.apache.xmlgraphics:batik-script:${ batikVersion} " ) {
113
- exclude group : ' xalan' , module : ' xalan'
114
- exclude group : ' xml-apis' , module : ' xml-apis'
115
- }
116
108
117
109
118
110
if (! NO_SCRATCHPAD ) {
@@ -134,19 +126,29 @@ dependencies {
134
126
testImplementation " org.apache.logging.log4j:log4j-slf4j2-impl:${ log4jVersion} "
135
127
testImplementation ' org.slf4j:slf4j-simple:2.0.16'
136
128
129
+ broken(" org.apache.xmlgraphics:batik-script:${ batikVersion} " ){
130
+ exclude group : ' xalan' , module : ' xalan'
131
+ exclude group : ' xml-apis' , module : ' xml-apis'
132
+ }
133
+
137
134
javadocs project(' :poi' )
138
135
javadocs project(' :poi-scratchpad' )
139
136
}
140
137
141
138
final String MODULE_NAME = ' org.apache.poi.ooxml'
139
+ final Pattern MODULE_NOT_REGEX = ~' (poi[/\\\\ ][^/\\\\ ]+$|batik-script)'
142
140
final Pattern MODULE_REGEX = ~' \\ .jar$'
143
141
final List MAIN_MODULE_PATH = sourceSets. main. runtimeClasspath. findAll{ it. path =~ MODULE_REGEX }. collect{ it. parent }. unique()
144
- final List TEST_MODULE_PATH = sourceSets. test. runtimeClasspath. findAll{ it. path =~ MODULE_REGEX }. collect{ it. parent }. unique()
142
+ final List TEST_MODULE_PATH = sourceSets. test. runtimeClasspath. findAll{ it. path =~ MODULE_REGEX && ! (it . path =~ MODULE_NOT_REGEX ) }. collect{ it. parent }. unique() + files( " build/brokenJars " )
145
143
146
144
final String OOXML_LITE_AGENT = " ../build/dist/maven/poi-ooxml-lite-agent/poi-ooxml-lite-agent-${ project.version} .jar"
147
145
final String OOXML_LITE_REPORT = ' ../src/resources/ooxml-lite-report'
148
146
final String OOXML_LITE_INCLUDES = " ^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"
149
147
148
+ compileJava {
149
+ dependsOn ' fixBatik' , ' cleanupBatik'
150
+ }
151
+
150
152
task compileJava9 (type : JavaCompile ) {
151
153
dependsOn ' compileJava' , ' :poi:jar'
152
154
@@ -206,6 +208,25 @@ task testJar(type: Jar, dependsOn: testClasses) {
206
208
}
207
209
}
208
210
211
+ // based on https://github.com/moditect/moditect-gradle-plugin/issues/12
212
+ task fixBatik (type : Zip ) {
213
+ ant. mkdir(dir : " ${ buildDir} /brokenJars" )
214
+ archiveFileName = " batik-script-${ batikVersion} .jar"
215
+ destinationDirectory = file(" ${ buildDir} /brokenJars" )
216
+ from zipTree(configurations. broken. files. find{ f -> f. name. startsWith(" batik-script" ) })
217
+ filesMatching(" **/org.apache.batik.script.InterpreterFactory" ) {
218
+ it. filter{ it2 -> it2. contains(" Rhino" ) ? " #" + it2 : it2 }
219
+ }
220
+ }
221
+
222
+ task cleanupBatik (type : Delete ) {
223
+ // remove older files to avoid build failures because of duplicate modules
224
+ delete fileTree(" ${ buildDir} /brokenJars/" ). matching {
225
+ include " *.jar"
226
+ exclude " batik*-${ batikVersion} .jar"
227
+ }
228
+ }
229
+
209
230
javadoc {
210
231
failOnError = true
211
232
doFirst {
0 commit comments