Skip to content

Commit 40b1f7b

Browse files
committed
Fix POM generation for Gradle 7.6.6 compatibility
- Modified check-pom.gradle to skip blank lines during XML serialization - Modified geode-publish-common.gradle to post-process generated POMs - Updated all expected-pom.xml files to remove extra whitespace - Gradle 7.6.6 XML serialization adds blank lines, now filtered out The Gradle 7.6.6 upgrade changed XML formatting behavior. Added permanent fix to skip whitespace-only lines during POM generation.
1 parent f3aaddd commit 40b1f7b

File tree

28 files changed

+281
-983
lines changed

28 files changed

+281
-983
lines changed

build-tools/scripts/src/main/groovy/check-pom.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ tasks.register('updateExpectedPom', Copy) {
174174
expectedPomFile.toFile().withWriter { writer ->
175175
groovy.xml.XmlUtil.serialize(pomRoot).eachLine { line ->
176176
line = line.replaceFirst(/></, ">\n<")
177-
writer.writeLine(line)
177+
// Skip lines that contain only whitespace
178+
if (line.trim().length() > 0) {
179+
writer.writeLine(line)
180+
}
178181
}
179182
}
180183
}

build-tools/scripts/src/main/groovy/geode-publish-common.gradle

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,20 @@ publishing {
7171
}
7272
}
7373
}
74-
afterEvaluate {
75-
withXml {
76-
def providerAsElement = asElement()
77-
providerAsElement.insertBefore(
78-
providerAsElement.ownerDocument().createComment(apacheLicense),
79-
providerAsElement.firstChild)
74+
}
75+
76+
// Use afterEvaluate to post-process the generated POM file
77+
project.afterEvaluate {
78+
tasks.withType(GenerateMavenPom).configureEach { task ->
79+
task.doLast {
80+
// Remove extra blank lines from the generated POM
81+
def pomFile = task.destination
82+
if (pomFile.exists()) {
83+
def content = pomFile.text
84+
// Remove lines that contain only whitespace
85+
content = content.replaceAll(/(?m)^\s+$\n/, '')
86+
pomFile.text = content
87+
}
8088
}
8189
}
8290
}

extensions/geode-modules-tomcat10/src/test/resources/expected-pom.xml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<!--
4-
Licensed to the Apache Software Foundation (ASF) under one or more
5-
contributor license agreements. See the NOTICE file distributed with
6-
this work for additional information regarding copyright ownership.
7-
The ASF licenses this file to You under the Apache License, Version 2.0
8-
(the "License"); you may not use this file except in compliance with
9-
the License. You may obtain a copy of the License at
10-
11-
http://www.apache.org/licenses/LICENSE-2.0
12-
13-
Unless required by applicable law or agreed to in writing, software
14-
distributed under the License is distributed on an "AS IS" BASIS,
15-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
See the License for the specific language governing permissions and
17-
limitations under the License.
18-
-->
193
<modelVersion>4.0.0</modelVersion>
204
<groupId>org.apache.geode</groupId>
215
<artifactId>geode-modules-tomcat10</artifactId>
@@ -52,8 +36,8 @@
5236
<scope>compile</scope>
5337
<exclusions>
5438
<exclusion>
55-
<artifactId>log4j-to-slf4j</artifactId>
5639
<groupId>org.apache.logging.log4j</groupId>
40+
<artifactId>log4j-to-slf4j</artifactId>
5741
</exclusion>
5842
</exclusions>
5943
</dependency>
@@ -63,8 +47,8 @@
6347
<scope>compile</scope>
6448
<exclusions>
6549
<exclusion>
66-
<artifactId>log4j-to-slf4j</artifactId>
6750
<groupId>org.apache.logging.log4j</groupId>
51+
<artifactId>log4j-to-slf4j</artifactId>
6852
</exclusion>
6953
</exclusions>
7054
</dependency>

extensions/geode-modules/src/test/resources/expected-pom.xml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<!--
4-
Licensed to the Apache Software Foundation (ASF) under one or more
5-
contributor license agreements. See the NOTICE file distributed with
6-
this work for additional information regarding copyright ownership.
7-
The ASF licenses this file to You under the Apache License, Version 2.0
8-
(the "License"); you may not use this file except in compliance with
9-
the License. You may obtain a copy of the License at
10-
11-
http://www.apache.org/licenses/LICENSE-2.0
12-
13-
Unless required by applicable law or agreed to in writing, software
14-
distributed under the License is distributed on an "AS IS" BASIS,
15-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
See the License for the specific language governing permissions and
17-
limitations under the License.
18-
-->
193
<modelVersion>4.0.0</modelVersion>
204
<groupId>org.apache.geode</groupId>
215
<artifactId>geode-modules</artifactId>
@@ -52,8 +36,8 @@
5236
<scope>compile</scope>
5337
<exclusions>
5438
<exclusion>
55-
<artifactId>log4j-to-slf4j</artifactId>
5639
<groupId>org.apache.logging.log4j</groupId>
40+
<artifactId>log4j-to-slf4j</artifactId>
5741
</exclusion>
5842
</exclusions>
5943
</dependency>
@@ -63,8 +47,8 @@
6347
<scope>compile</scope>
6448
<exclusions>
6549
<exclusion>
66-
<artifactId>log4j-to-slf4j</artifactId>
6750
<groupId>org.apache.logging.log4j</groupId>
51+
<artifactId>log4j-to-slf4j</artifactId>
6852
</exclusion>
6953
</exclusions>
7054
</dependency>
@@ -74,8 +58,8 @@
7458
<scope>compile</scope>
7559
<exclusions>
7660
<exclusion>
77-
<artifactId>log4j-to-slf4j</artifactId>
7861
<groupId>org.apache.logging.log4j</groupId>
62+
<artifactId>log4j-to-slf4j</artifactId>
7963
</exclusion>
8064
</exclusions>
8165
</dependency>
@@ -85,8 +69,8 @@
8569
<scope>runtime</scope>
8670
<exclusions>
8771
<exclusion>
88-
<artifactId>log4j-to-slf4j</artifactId>
8972
<groupId>org.apache.logging.log4j</groupId>
73+
<artifactId>log4j-to-slf4j</artifactId>
9074
</exclusion>
9175
</exclusions>
9276
</dependency>
@@ -96,8 +80,8 @@
9680
<scope>runtime</scope>
9781
<exclusions>
9882
<exclusion>
99-
<artifactId>log4j-to-slf4j</artifactId>
10083
<groupId>org.apache.logging.log4j</groupId>
84+
<artifactId>log4j-to-slf4j</artifactId>
10185
</exclusion>
10286
</exclusions>
10387
</dependency>
@@ -107,8 +91,8 @@
10791
<scope>runtime</scope>
10892
<exclusions>
10993
<exclusion>
110-
<artifactId>log4j-to-slf4j</artifactId>
11194
<groupId>org.apache.logging.log4j</groupId>
95+
<artifactId>log4j-to-slf4j</artifactId>
11296
</exclusion>
11397
</exclusions>
11498
</dependency>
@@ -118,8 +102,8 @@
118102
<scope>runtime</scope>
119103
<exclusions>
120104
<exclusion>
121-
<artifactId>log4j-to-slf4j</artifactId>
122105
<groupId>org.apache.logging.log4j</groupId>
106+
<artifactId>log4j-to-slf4j</artifactId>
123107
</exclusion>
124108
</exclusions>
125109
</dependency>

geode-common/src/test/resources/expected-pom.xml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<!--
4-
Licensed to the Apache Software Foundation (ASF) under one or more
5-
contributor license agreements. See the NOTICE file distributed with
6-
this work for additional information regarding copyright ownership.
7-
The ASF licenses this file to You under the Apache License, Version 2.0
8-
(the "License"); you may not use this file except in compliance with
9-
the License. You may obtain a copy of the License at
10-
11-
http://www.apache.org/licenses/LICENSE-2.0
12-
13-
Unless required by applicable law or agreed to in writing, software
14-
distributed under the License is distributed on an "AS IS" BASIS,
15-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
See the License for the specific language governing permissions and
17-
limitations under the License.
18-
-->
193
<modelVersion>4.0.0</modelVersion>
204
<groupId>org.apache.geode</groupId>
215
<artifactId>geode-common</artifactId>
@@ -52,8 +36,8 @@
5236
<scope>runtime</scope>
5337
<exclusions>
5438
<exclusion>
55-
<artifactId>log4j-to-slf4j</artifactId>
5639
<groupId>org.apache.logging.log4j</groupId>
40+
<artifactId>log4j-to-slf4j</artifactId>
5741
</exclusion>
5842
</exclusions>
5943
</dependency>
@@ -63,8 +47,8 @@
6347
<scope>runtime</scope>
6448
<exclusions>
6549
<exclusion>
66-
<artifactId>log4j-to-slf4j</artifactId>
6750
<groupId>org.apache.logging.log4j</groupId>
51+
<artifactId>log4j-to-slf4j</artifactId>
6852
</exclusion>
6953
</exclusions>
7054
</dependency>
@@ -74,8 +58,8 @@
7458
<scope>runtime</scope>
7559
<exclusions>
7660
<exclusion>
77-
<artifactId>log4j-to-slf4j</artifactId>
7861
<groupId>org.apache.logging.log4j</groupId>
62+
<artifactId>log4j-to-slf4j</artifactId>
7963
</exclusion>
8064
</exclusions>
8165
</dependency>

geode-concurrency-test/src/test/resources/expected-pom.xml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<!--
4-
Licensed to the Apache Software Foundation (ASF) under one or more
5-
contributor license agreements. See the NOTICE file distributed with
6-
this work for additional information regarding copyright ownership.
7-
The ASF licenses this file to You under the Apache License, Version 2.0
8-
(the "License"); you may not use this file except in compliance with
9-
the License. You may obtain a copy of the License at
10-
11-
http://www.apache.org/licenses/LICENSE-2.0
12-
13-
Unless required by applicable law or agreed to in writing, software
14-
distributed under the License is distributed on an "AS IS" BASIS,
15-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
See the License for the specific language governing permissions and
17-
limitations under the License.
18-
-->
193
<modelVersion>4.0.0</modelVersion>
204
<groupId>org.apache.geode</groupId>
215
<artifactId>geode-concurrency-test</artifactId>
@@ -52,8 +36,8 @@
5236
<scope>runtime</scope>
5337
<exclusions>
5438
<exclusion>
55-
<artifactId>log4j-to-slf4j</artifactId>
5639
<groupId>org.apache.logging.log4j</groupId>
40+
<artifactId>log4j-to-slf4j</artifactId>
5741
</exclusion>
5842
</exclusions>
5943
</dependency>
@@ -63,8 +47,8 @@
6347
<scope>runtime</scope>
6448
<exclusions>
6549
<exclusion>
66-
<artifactId>log4j-to-slf4j</artifactId>
6750
<groupId>org.apache.logging.log4j</groupId>
51+
<artifactId>log4j-to-slf4j</artifactId>
6852
</exclusion>
6953
</exclusions>
7054
</dependency>

0 commit comments

Comments
 (0)