Skip to content

Commit a076e79

Browse files
committed
Add Maven profiles
* to support building and packaging artifacts targeting different versions of the JDK/JRE * default build target Java 8 * other variants activated by detecting installed version of JDK (or explicit override) * Java 17 and Java 21 set properties that affect dependency and plugin versions of Square's Wire and Spring Boot * Added Github Action workflows to get signal and feedback on activated Maven profiles * tests are skipped (for now)
1 parent a38a980 commit a076e79

File tree

5 files changed

+209
-13
lines changed

5 files changed

+209
-13
lines changed

.github/workflows/codeql.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ "main" ]
20+
schedule:
21+
- cron: '35 3 * * 6'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
# Runner size impacts CodeQL analysis time. To learn more, please see:
27+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
28+
# - https://gh.io/supported-runners-and-hardware-resources
29+
# - https://gh.io/using-larger-runners
30+
# Consider using larger runners for possible analysis time improvements.
31+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
32+
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
33+
permissions:
34+
actions: read
35+
contents: read
36+
security-events: write
37+
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
language: [ 'java' ]
42+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
43+
# Use only 'java' to analyze code written in Java, Kotlin or both
44+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
45+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
46+
47+
steps:
48+
- name: Checkout repository
49+
uses: actions/checkout@v3
50+
51+
- name: Set up Java
52+
uses: actions/setup-java@v3
53+
with:
54+
distribution: liberica
55+
java-version: 17
56+
57+
- name: Cache Maven packages
58+
uses: actions/cache@v3
59+
with:
60+
path: ~/.m2
61+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
62+
restore-keys: ${{ runner.os }}-m2
63+
64+
# Initializes the CodeQL tools for scanning.
65+
- name: Initialize CodeQL
66+
uses: github/codeql-action/init@v2
67+
with:
68+
languages: ${{ matrix.language }}
69+
# If you wish to specify custom queries, you can do so here or in a config file.
70+
# By default, queries listed here will override any specified in a config file.
71+
# Prefix the list here with "+" to use these queries and those in the config file.
72+
73+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
74+
# queries: security-extended,security-and-quality
75+
76+
77+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
78+
# If this step fails, then you should remove it and run the build manually (see below)
79+
- name: Autobuild
80+
uses: github/codeql-action/autobuild@v2
81+
82+
# ℹ️ Command-line programs to run using the OS shell.
83+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
84+
85+
# If the Autobuild fails above, remove it and uncomment the following three lines.
86+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
87+
88+
# - run: |
89+
# echo "Run, Build Application using script"
90+
# ./location_of_script_within_repo/buildscript.sh
91+
92+
- name: Perform CodeQL Analysis
93+
uses: github/codeql-action/analyze@v2
94+
with:
95+
category: "/language:${{matrix.language}}"

.github/workflows/maven.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Java CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
java: [ 8, 11, 17, 21 ]
11+
name: Java ${{ matrix.java }} build
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Java
15+
uses: actions/setup-java@v3
16+
with:
17+
distribution: liberica
18+
java-version: ${{ matrix.java }}
19+
- name: Cache Maven packages
20+
uses: actions/cache@v3
21+
with:
22+
path: ~/.m2
23+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
24+
restore-keys: ${{ runner.os }}-m2
25+
- name: Build with Maven
26+
run: ./mvnw clean install -DskipTests -Dgpg.skip

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ bin/
99
.settings/
1010
.factorypath
1111
.gradle
12+
.vscode
1213
.history
14+
*.log

cloudfoundry-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
</dependency>
4646
<dependency>
4747
<groupId>com.squareup.wire</groupId>
48-
<artifactId>wire-runtime-jvm</artifactId>
48+
<artifactId>wire-runtime${wire.suffix}</artifactId>
4949
</dependency>
5050
<dependency>
5151
<groupId>org.springframework.boot</groupId>

pom.xml

Lines changed: 85 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,23 @@
5555
</modules>
5656

5757
<properties>
58-
<java.version>17</java.version>
58+
<java.version>1.8</java.version>
59+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
60+
61+
<dependencies.version>2.7.16</dependencies.version>
62+
5963
<commons-compress.version>1.24.0</commons-compress.version>
6064
<commons-lang3.version>3.13.0</commons-lang3.version>
61-
<dependencies.version>3.1.4</dependencies.version>
6265
<evo-inflector.version>1.3</evo-inflector.version>
6366
<immutables.version>2.10.0-rc1</immutables.version>
6467
<java-semver.version>0.9.0</java-semver.version>
6568
<jjwt.version>0.11.5</jjwt.version>
66-
<wire.version>4.9.1</wire.version>
67-
<mockito.version>5.5.0</mockito.version>
6869
<junit-jupiter.version>5.10.0</junit-jupiter.version>
70+
<mockito.version>5.5.0</mockito.version>
6971
<snakeyaml.version>2.2</snakeyaml.version>
70-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
72+
<wire.version>2.2.0</wire.version>
73+
<wire.plugin.version>2.2.0</wire.plugin.version>
74+
<wire.suffix></wire.suffix>
7175
</properties>
7276

7377
<dependencyManagement>
@@ -87,7 +91,7 @@
8791
</dependency>
8892
<dependency>
8993
<groupId>com.squareup.wire</groupId>
90-
<artifactId>wire-runtime-jvm</artifactId>
94+
<artifactId>wire-runtime${wire.suffix}</artifactId>
9195
<version>${wire.version}</version>
9296
</dependency>
9397
<dependency>
@@ -131,7 +135,7 @@
131135
<plugin>
132136
<groupId>com.squareup.wire</groupId>
133137
<artifactId>wire-maven-plugin</artifactId>
134-
<version>3.0.2</version>
138+
<version>${wire.plugin.version}</version>
135139
<executions>
136140
<execution>
137141
<phase>generate-sources</phase>
@@ -145,11 +149,12 @@
145149
<groupId>org.apache.maven.plugins</groupId>
146150
<artifactId>maven-compiler-plugin</artifactId>
147151
<version>3.11.0</version>
148-
<!-- @see https://github.com/immutables/immutables/issues/1339#issuecomment-1016125673 -->
149152
<configuration>
150-
<fork>true</fork>
151-
<compilerArgs combine.children="append">
152-
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
153+
<compilerArgs>
154+
<arg>-Xlint:all</arg>
155+
<arg>-Xlint:-options</arg>
156+
<arg>-Xlint:-processing</arg>
157+
<arg>-Xlint:-serial</arg>
153158
</compilerArgs>
154159
<showWarnings>true</showWarnings>
155160
<source>${java.version}</source>
@@ -180,7 +185,7 @@
180185
<executions>
181186
<execution>
182187
<id>attach-javadocs</id>
183-
<goals>
188+
<goals>
184189
<goal>jar</goal>
185190
</goals>
186191
</execution>
@@ -303,6 +308,74 @@
303308
<module>test-service-broker</module>
304309
</modules>
305310
</profile>
311+
312+
<profile>
313+
<id>jdk-17</id>
314+
<activation>
315+
<jdk>17</jdk>
316+
</activation>
317+
<properties>
318+
<java.version>17</java.version>
319+
<dependencies.version>3.1.4</dependencies.version>
320+
<wire.version>4.9.1</wire.version>
321+
<wire.plugin.version>3.0.2</wire.plugin.version>
322+
<wire.suffix>-jvm</wire.suffix>
323+
</properties>
324+
<build>
325+
<finalName>${project.artifactId}-jdk17-${project.version}</finalName>
326+
<plugins>
327+
<plugin>
328+
<groupId>org.apache.maven.plugins</groupId>
329+
<artifactId>maven-compiler-plugin</artifactId>
330+
<version>3.11.0</version>
331+
<!-- @see https://github.com/immutables/immutables/issues/1339#issuecomment-1016125673 -->
332+
<configuration>
333+
<fork>true</fork>
334+
<compilerArgs combine.children="append">
335+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
336+
</compilerArgs>
337+
<showWarnings>true</showWarnings>
338+
<source>${java.version}</source>
339+
<target>${java.version}</target>
340+
</configuration>
341+
</plugin>
342+
</plugins>
343+
</build>
344+
</profile>
345+
346+
<profile>
347+
<id>jdk-21</id>
348+
<activation>
349+
<jdk>21</jdk>
350+
</activation>
351+
<properties>
352+
<java.version>21</java.version>
353+
<dependencies.version>3.1.4</dependencies.version>
354+
<wire.version>4.9.1</wire.version>
355+
<wire.plugin.version>3.0.2</wire.plugin.version>
356+
<wire.suffix>-jvm</wire.suffix>
357+
</properties>
358+
<build>
359+
<finalName>${project.artifactId}-jdk21-${project.version}</finalName>
360+
<plugins>
361+
<plugin>
362+
<groupId>org.apache.maven.plugins</groupId>
363+
<artifactId>maven-compiler-plugin</artifactId>
364+
<version>3.11.0</version>
365+
<!-- @see https://github.com/immutables/immutables/issues/1339#issuecomment-1016125673 -->
366+
<configuration>
367+
<fork>true</fork>
368+
<compilerArgs combine.children="append">
369+
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
370+
</compilerArgs>
371+
<showWarnings>true</showWarnings>
372+
<source>${java.version}</source>
373+
<target>${java.version}</target>
374+
</configuration>
375+
</plugin>
376+
</plugins>
377+
</build>
378+
</profile>
306379
</profiles>
307380

308381
</project>

0 commit comments

Comments
 (0)