Skip to content

Commit 0b32a0e

Browse files
committed
CXF-9158: Make CXF buildable offline with -Doffline
1 parent c7277e2 commit 0b32a0e

File tree

4 files changed

+16044
-57
lines changed

4 files changed

+16044
-57
lines changed

.github/workflows/pull-request-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,9 @@ jobs:
3131
- name: Build with Apache Maven
3232
if: ${{ matrix.os != 'windows-latest' }}
3333
run: mvn -U clean install -Djava.awt.headless=true -fae -B -Peverything
34+
- name: Fail if there are uncommitted changes in public-suffix-list.txt
35+
shell: bash
36+
run: |
37+
[[ -z $(git status --porcelain rt/transports/http/src/main/resources/mozilla/public-suffix-list.txt) ]] || { echo 'There are uncommitted changes in public-suffix-list.txt'; git status; git diff; exit 1; }
3438
env:
3539
MAVEN_OPTS: "-Xmx1024M"

parent/pom.xml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<cxf.geronimo.openapi.version>1.0.15</cxf.geronimo.openapi.version>
119119
<cxf.glassfish.el.version>4.0.2</cxf.glassfish.el.version>
120120
<cxf.glassfish.json.version>2.0.1</cxf.glassfish.json.version>
121+
<cxf.groovy.version>4.0.27</cxf.groovy.version>
121122
<cxf.hamcrest.version>3.0</cxf.hamcrest.version>
122123
<cxf.hazelcast.version>5.5.0</cxf.hazelcast.version>
123124
<cxf.hibernate.em.version>6.6.15.Final</cxf.hibernate.em.version>
@@ -585,7 +586,19 @@
585586
<dependency>
586587
<groupId>org.apache.groovy</groupId>
587588
<artifactId>groovy</artifactId>
588-
<version>4.0.27</version>
589+
<version>${cxf.groovy.version}</version>
590+
</dependency>
591+
</dependencies>
592+
</plugin>
593+
<plugin>
594+
<groupId>org.codehaus.gmaven</groupId>
595+
<artifactId>groovy-maven-plugin</artifactId>
596+
<version>2.1.1</version>
597+
<dependencies>
598+
<dependency>
599+
<groupId>org.apache.groovy</groupId>
600+
<artifactId>groovy</artifactId>
601+
<version>${cxf.groovy.version}</version>
589602
</dependency>
590603
</dependencies>
591604
</plugin>
@@ -2231,7 +2244,7 @@
22312244
<name>ekstazi</name>
22322245
</property>
22332246
</activation>
2234-
2247+
22352248
<build>
22362249
<plugins>
22372250
<plugin>
@@ -2252,7 +2265,7 @@
22522265
</execution>
22532266
</executions>
22542267
</plugin>
2255-
2268+
22562269
<plugin>
22572270
<artifactId>maven-surefire-plugin</artifactId>
22582271
<configuration>

rt/transports/http/pom.xml

Lines changed: 46 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -157,60 +157,52 @@
157157
</extensions>
158158
</configuration>
159159
</plugin>
160-
<plugin>
161-
<groupId>com.googlecode.maven-download-plugin</groupId>
162-
<artifactId>download-maven-plugin</artifactId>
163-
<version>1.13.0</version>
164-
<executions>
165-
<execution>
166-
<id>download-public-suffix-list</id>
167-
<phase>generate-sources</phase>
168-
<goals>
169-
<goal>wget</goal>
170-
</goals>
171-
<configuration>
172-
<url>${cxf.public.suffix.list.url}</url>
173-
<outputDirectory>${project.build.outputDirectory}/mozilla</outputDirectory>
174-
<outputFileName>public-suffix-list.txt</outputFileName>
175-
</configuration>
176-
</execution>
177-
</executions>
178-
</plugin>
179160
</plugins>
180-
<pluginManagement>
181-
<plugins>
182-
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
183-
<plugin>
184-
<groupId>org.eclipse.m2e</groupId>
185-
<artifactId>lifecycle-mapping</artifactId>
186-
<version>1.0.0</version>
187-
<configuration>
188-
<lifecycleMappingMetadata>
189-
<pluginExecutions>
190-
<pluginExecution>
191-
<pluginExecutionFilter>
192-
<groupId>
193-
com.googlecode.maven-download-plugin
194-
</groupId>
195-
<artifactId>
196-
download-maven-plugin
197-
</artifactId>
198-
<versionRange>
199-
[1.2.0,)
200-
</versionRange>
201-
<goals>
202-
<goal>wget</goal>
203-
</goals>
204-
</pluginExecutionFilter>
205-
<action>
206-
<ignore />
207-
</action>
208-
</pluginExecution>
209-
</pluginExecutions>
210-
</lifecycleMappingMetadata>
211-
</configuration>
212-
</plugin>
213-
</plugins>
214-
</pluginManagement>
215161
</build>
162+
<profiles>
163+
<profile>
164+
<id>online</id>
165+
<activation>
166+
<property>
167+
<!-- Active by default, Inactive with -Doffline -->
168+
<name>!offline</name>
169+
</property>
170+
</activation>
171+
<build>
172+
<plugins>
173+
<plugin>
174+
<groupId>org.codehaus.gmaven</groupId>
175+
<artifactId>groovy-maven-plugin</artifactId>
176+
<executions>
177+
<execution>
178+
<id>download-public-suffix-list</id>
179+
<phase>generate-sources</phase>
180+
<goals>
181+
<goal>execute</goal>
182+
</goals>
183+
<configuration>
184+
<!-- Download the suffix file and store it locally only if the content changes -->
185+
<!-- so that the file timestamp does not change on every build -->
186+
<source>
187+
import java.nio.file.Files
188+
def newContent = new URL(project.properties['cxf.public.suffix.list.url']).text
189+
String relPath = 'src/main/resources/mozilla/public-suffix-list.txt'
190+
def destPath = java.nio.file.Path.of(project.properties['project.basedir'] + relPath)
191+
if (!Files.exists(destPath) || !newContent.equals(destPath.getText('UTF-8'))) {
192+
Files.createDirectories(destPath.getParent())
193+
destPath.setText(newContent.toString(), 'UTF-8')
194+
println('🚀 Updating ' + relPath)
195+
} else {
196+
println('✅ Up to date: ' + relPath)
197+
}
198+
</source>
199+
</configuration>
200+
</execution>
201+
</executions>
202+
</plugin>
203+
</plugins>
204+
</build>
205+
206+
</profile>
207+
</profiles>
216208
</project>

0 commit comments

Comments
 (0)