Skip to content

Commit 79f0567

Browse files
committed
Build with JDK 21
1 parent 1ff0fc2 commit 79f0567

4 files changed

Lines changed: 78 additions & 15 deletions

File tree

.gitattributes

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
# Auto detect text files and perform LF normalization
21+
* text=auto eol=lf
22+
23+
# Declare files with fixed line ending for tests.
24+
src/test/resources/**/* binary diff
25+
26+
# Custom for Visual Studio
27+
*.cs diff=csharp
28+
*.sln merge=union
29+
*.csproj merge=union
30+
*.vbproj merge=union
31+
*.fsproj merge=union
32+
*.dbproj merge=union
33+
34+
# Standard to msysgit
35+
*.doc diff=astextplain
36+
*.DOC diff=astextplain
37+
*.docx diff=astextplain
38+
*.DOCX diff=astextplain
39+
*.dot diff=astextplain
40+
*.DOT diff=astextplain
41+
*.pdf diff=astextplain
42+
*.PDF diff=astextplain
43+
*.rtf diff=astextplain
44+
*.RTF diff=astextplain

.github/workflows/maven.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@
33

44
name: mvn verify
55

6-
on: [push, pull_request, workflow_dispatch]
6+
on:
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
permissions:
13+
contents: read
714

815
jobs:
916
build:
1017
strategy:
1118
matrix:
1219
os: [ubuntu-latest, windows-latest, macos-latest]
13-
java: [17, 21]
14-
include:
15-
- { os: ubuntu-latest, verifyFormatOpt: '-Drevelc.verifyFormat' }
16-
- { os: macos-latest, verifyFormatOpt: '-Drevelc.verifyFormat' }
17-
- { os: windows-latest, verifyFormatOpt: '-Drevelc.skipFormat' }
20+
java: [21]
1821
fail-fast: false
1922
runs-on: ${{ matrix.os }}
2023
steps:
@@ -26,9 +29,9 @@ jobs:
2629
distribution: temurin
2730
cache: 'maven'
2831
- name: Download Maven Wrapper
29-
run: mvn wrapper:wrapper "-Dmaven=3.9.8"
32+
run: mvn wrapper:wrapper "-Dmaven=3.9.16"
3033
- name: Build with Maven
31-
run: ./mvnw -B -V -e "-Dstyle.color=always" verify "-Drevelc.skipFormat" "${{ matrix.verifyFormatOpt }}"
34+
run: ./mvnw -B -V -e "-Dstyle.color=always" verify "-Drevelc.skipFormat" "-Drevelc.verifyFormat"
3235
env:
3336
MAVEN_OPTS: -Djansi.force=true
3437
- name: View IT build log on failure

pom.xml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<parent>
2020
<groupId>net.revelc.code</groupId>
2121
<artifactId>revelc</artifactId>
22-
<version>9</version>
22+
<version>10</version>
2323
</parent>
2424
<artifactId>apilyzer-maven-plugin</artifactId>
2525
<version>1.3.1-SNAPSHOT</version>
@@ -47,7 +47,10 @@
4747
<properties>
4848
<formatter.configFile>src/build/eclipse-java-style.xml</formatter.configFile>
4949
<invoker.streamLogs>true</invoker.streamLogs>
50-
<maven.compiler.release>8</maven.compiler.release>
50+
<maven.compiler.release>11</maven.compiler.release>
51+
<revelc.min-build-jdk>21</revelc.min-build-jdk>
52+
<!-- plugin and dependency versions -->
53+
<version.checkstyle>13.4.2</version.checkstyle>
5154
</properties>
5255
<dependencyManagement>
5356
<dependencies>
@@ -79,7 +82,7 @@
7982
<dependency>
8083
<groupId>com.puppycrawl.tools</groupId>
8184
<artifactId>checkstyle</artifactId>
82-
<version>13.4.0</version>
85+
<version>${version.checkstyle}</version>
8386
</dependency>
8487
</dependencies>
8588
<executions>
@@ -91,6 +94,18 @@
9194
</execution>
9295
</executions>
9396
</plugin>
97+
<plugin>
98+
<groupId>com.github.spotbugs</groupId>
99+
<artifactId>spotbugs-maven-plugin</artifactId>
100+
<executions>
101+
<execution>
102+
<id>run-spotbugs</id>
103+
<goals>
104+
<goal>check</goal>
105+
</goals>
106+
</execution>
107+
</executions>
108+
</plugin>
94109
</plugins>
95110
</build>
96111
</project>

src/main/java/net/revelc/code/apilyzer/maven/plugin/AnalyzeMojo.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
package net.revelc.code.apilyzer.maven.plugin;
1616

17+
import static java.nio.charset.StandardCharsets.UTF_8;
18+
1719
import com.google.common.reflect.ClassPath;
1820
import com.google.common.reflect.ClassPath.ClassInfo;
1921
import java.io.File;
20-
import java.io.FileNotFoundException;
2122
import java.io.IOException;
2223
import java.io.PrintStream;
2324
import java.lang.annotation.Annotation;
@@ -239,7 +240,7 @@ public class AnalyzeMojo extends AbstractMojo {
239240
private List<String> excludeAnnotations = Collections.emptyList();
240241
private PatternSet excludeAnnotationsPs;
241242

242-
private static final String FORMAT = " %-20s %-60s %-35s %s\n";
243+
private static final String FORMAT = " %-20s %-60s %-35s %s%n";
243244

244245
@Override
245246
public void execute() throws MojoFailureException, MojoExecutionException {
@@ -264,7 +265,7 @@ public void execute() throws MojoFailureException, MojoExecutionException {
264265
throw new MojoExecutionException("Error resolving project classpath", e);
265266
}
266267

267-
try (PrintStream out = new PrintStream(new File(outputFile))) {
268+
try (PrintStream out = new PrintStream(new File(outputFile), UTF_8)) {
268269

269270
out.println("Includes: " + includes);
270271
out.println("IncludeAnnotations: " + includeAnnotations);
@@ -314,7 +315,7 @@ public void execute() throws MojoFailureException, MojoExecutionException {
314315
getLog().error(msg);
315316
throw new MojoFailureException(msg);
316317
}
317-
} catch (FileNotFoundException e) {
318+
} catch (IOException e) {
318319
throw new MojoExecutionException("Bad configuration: cannot create specified outputFile", e);
319320
}
320321
}

0 commit comments

Comments
 (0)