Skip to content

Commit

Permalink
Uptake Maven 3.9.x (#1004)
Browse files Browse the repository at this point in the history
- Fix warnings (dependency convergence, read-only config etc)
- Update several Maven plugins & dependencies
- Update spotbug excludes
- Uptake new checkstyle + related checkstyle fixes
  • Loading branch information
romain-grecourt authored Dec 19, 2023
1 parent 5e64f84 commit 9373804
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 78 deletions.
24 changes: 10 additions & 14 deletions cli/codegen/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>META-INF/services/com.sun.source.util.Plugin</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -71,26 +79,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>default-resources</id>
<configuration>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>META-INF/services/com.sun.source.util.Plugin</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>javac-plugin</id>
<goals>
<goal>resources</goal>
<goal>copy-resources</goal>
</goals>
<phase>process-classes</phase>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
Expand Down
4 changes: 2 additions & 2 deletions cli/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reuseForks>false</reuseForks>
<systemProperties>
<systemPropertyVariables>
<helidon.test.version>2.5.0</helidon.test.version>
</systemProperties>
</systemPropertyVariables>
<environmentVariables>
<formatEnv>%s</formatEnv>
</environmentVariables>
Expand Down
9 changes: 4 additions & 5 deletions common/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@
</properties>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 4 additions & 0 deletions common/test-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-reporting</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
</dependencies>
</project>
3 changes: 3 additions & 0 deletions etc/scripts/checkstyle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ readonly RESULT_FILE

die(){ echo "${1}" ; exit 1 ;}

# Remove cache
rm -f "${WS_DIR}"/target/checkstyle-*

# shellcheck disable=SC2086
mvn ${MAVEN_ARGS} checkstyle:checkstyle-aggregate \
-f "${WS_DIR}"/pom.xml \
Expand Down
2 changes: 2 additions & 0 deletions ide-support/lsp/helidon-lsp-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
Expand All @@ -52,6 +53,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class InlusiveNamingConfig {
private XmlData[] additionalTerms;

/**
* XML file equivalent to the inclusive naming JSON {@link https://inclusivenaming.org/word-lists/index.json}.
* XML file equivalent to the inclusive naming <a href="https://inclusivenaming.org/word-lists/index.json">JSON</a>.
*/
@Parameter
private File inclusiveNamingFile;
Expand Down
25 changes: 25 additions & 0 deletions maven-plugins/helidon-archetype-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,31 @@
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings-builder</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-builder-support</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022 Oracle and/or its affiliates.
* Copyright (c) 2021, 2023 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,6 @@
import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
Expand All @@ -41,6 +40,9 @@
import com.github.mustachejava.reflect.SimpleObjectHandler;
import com.github.mustachejava.util.Wrapper;

import static java.nio.file.StandardOpenOption.CREATE;
import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;

/**
* Mustache helper.
*/
Expand Down Expand Up @@ -88,8 +90,7 @@ public static void renderMustacheTemplate(InputStream is, String name, Path targ

Mustache m = MUSTACHE_FACTORY.compile(new InputStreamReader(is), name);
Files.createDirectories(target.getParent());
try (Writer writer = Files.newBufferedWriter(target, StandardOpenOption.CREATE,
StandardOpenOption.TRUNCATE_EXISTING)) {
try (Writer writer = Files.newBufferedWriter(target, CREATE, TRUNCATE_EXISTING)) {
m.execute(writer, scope).flush();
}
}
Expand Down Expand Up @@ -122,7 +123,6 @@ public String toString() {
}
}


private static final class ObjectHandler extends SimpleObjectHandler {

@Override
Expand All @@ -141,10 +141,10 @@ public Wrapper find(String name, List<Object> ignore) {
result = ((Map<?, ?>) scope).get(name);
} else if (scope instanceof Map.Entry) {
switch (name) {
case("key"):
case "key":
result = ((Map.Entry<?, ?>) scope).getKey();
break;
case("value"):
case "value":
result = ((Map.Entry<?, ?>) scope).getValue();
break;
default:
Expand Down
9 changes: 7 additions & 2 deletions maven-plugins/helidon-cli-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
Expand Down Expand Up @@ -140,9 +145,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<systemPropertyVariables>
<version>${project.version}</version>
</systemProperties>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 2 additions & 2 deletions maven-plugins/services-maven-plugin/etc/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 Oracle and/or its affiliates.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@

<Match>
<!-- vulnerable to XML External Entity attacks -->
<Class name="io.helidon.build.maven.services.HelpMojo"/>
<Class name="io.helidon.build_tools.helidon_services_plugin.HelpMojo"/>
<Bug pattern="XXE_DOCUMENT"/>
</Match>

Expand Down
20 changes: 20 additions & 0 deletions maven-plugins/sitegen-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@
<artifactId>maven-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings-builder</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-builder-support</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 Oracle and/or its affiliates.
Copyright (c) 2022, 2023 Oracle and/or its affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@

<Match>
<!-- vulnerable to XML External Entity attacks -->
<Class name="io.helidon.build.maven.snakeyaml.codegen.HelpMojo"/>
<Class name="io.helidon.build_tools.snakeyaml_codegen_maven_plugin.HelpMojo"/>
<Bug pattern="XXE_DOCUMENT"/>
</Match>

Expand Down
Loading

0 comments on commit 9373804

Please sign in to comment.