diff --git a/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java b/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java index 49c8fa645af0..63fab89df526 100644 --- a/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java +++ b/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java @@ -537,7 +537,7 @@ public void putRemoteFile( // We do this in here so we can checksum the artifact metadata too, otherwise it could be metadata itself for (String extension : checksums.keySet()) { // TODO shouldn't need a file intermediary - improve wagon to take a stream - File temp = File.createTempFile("maven-artifact", null); + File temp = Files.createTempFile("maven-artifact", null).toFile(); temp.deleteOnExit(); byte[] bytes = sums.get(extension).getBytes(StandardCharsets.UTF_8); Files.write( diff --git a/compat/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java b/compat/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java index 47372855ca2d..bcd0b3688c35 100644 --- a/compat/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java +++ b/compat/maven-compat/src/test/java/org/apache/maven/artifact/testutils/TestFileManager.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -91,7 +92,7 @@ public synchronized File createTempDir() { } public synchronized File createTempFile() throws IOException { - File tempFile = File.createTempFile(baseFilename, fileSuffix); + File tempFile = Files.createTempFile(baseFilename, fileSuffix).toFile(); tempFile.deleteOnExit(); markForDeletion(tempFile); diff --git a/compat/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java b/compat/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java index a03184de6b83..ea1d033f0525 100644 --- a/compat/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java +++ b/compat/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; import org.codehaus.plexus.util.Os; import org.junit.jupiter.api.Test; @@ -64,7 +65,7 @@ void testWindowsPaths() throws Exception { } private File createTempFile(String name) throws IOException { - File tempFile = File.createTempFile(name, ".xml"); + File tempFile = Files.createTempFile(name, ".xml").toFile(); tempFile.deleteOnExit(); return tempFile; } diff --git a/impl/maven-core/src/test/java/org/apache/maven/graph/ProjectSelectorTest.java b/impl/maven-core/src/test/java/org/apache/maven/graph/ProjectSelectorTest.java index 2cdeac39b84b..c5020c8a42b0 100644 --- a/impl/maven-core/src/test/java/org/apache/maven/graph/ProjectSelectorTest.java +++ b/impl/maven-core/src/test/java/org/apache/maven/graph/ProjectSelectorTest.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -85,7 +86,8 @@ void isMatchingProjectMatchOnSelectorReturnsTrue(String selector) { @Test void isMatchingProjectMatchOnFileReturnsTrue() throws IOException { - final File tempFile = File.createTempFile("maven-core-unit-test-pom", ".xml"); + final File tempFile = + Files.createTempFile("maven-core-unit-test-pom", ".xml").toFile(); final String selector = tempFile.getName(); final MavenProject mavenProject = createMavenProject("maven-core"); mavenProject.setFile(tempFile); diff --git a/its/core-it-suite/src/test/resources/mng-0612/plugin/src/main/java/org/apache/maven/its/it0125/DependenciesMojo.java b/its/core-it-suite/src/test/resources/mng-0612/plugin/src/main/java/org/apache/maven/its/it0125/DependenciesMojo.java index 1580dc218867..d99a0026f6cc 100644 --- a/its/core-it-suite/src/test/resources/mng-0612/plugin/src/main/java/org/apache/maven/its/it0125/DependenciesMojo.java +++ b/its/core-it-suite/src/test/resources/mng-0612/plugin/src/main/java/org/apache/maven/its/it0125/DependenciesMojo.java @@ -39,8 +39,8 @@ import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Files; import java.util.Iterator; import java.util.Set; @@ -78,7 +78,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { } try { - BufferedWriter writer = new BufferedWriter(new FileWriter(file)); + BufferedWriter writer = Files.newBufferedWriter(file.toPath()); for (Iterator iterator = artifacts.iterator(); iterator.hasNext(); ) { Artifact artifact = (Artifact) iterator.next(); diff --git a/pom.xml b/pom.xml index e7fe0a767a64..7bc988072eb7 100644 --- a/pom.xml +++ b/pom.xml @@ -714,21 +714,21 @@ under the License. modello-maven-plugin Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. @@ -807,9 +807,59 @@ under the License. + + org.openrewrite.maven + rewrite-maven-plugin + 6.8.1 + + + + + + + + + + + + + + org.openrewrite.java.security.JavaSecurityBestPractices + org.openrewrite.staticanalysis.RemoveUnusedLocalVariables + + true + true + + + + org.openrewrite.recipe + rewrite-static-analysis + 2.9.0 + + + org.openrewrite.recipe + rewrite-java-security + 3.8.0 + + + + + rewrite-maven-plugin + + run + + verify + + + + + + org.openrewrite.maven + rewrite-maven-plugin + io.github.olamy.maven.plugins jacoco-aggregator-maven-plugin @@ -822,10 +872,10 @@ under the License. The mission of the Apache Maven project is to create and maintain software - libraries that provide a widely-used project build tool, targeting mainly Java - development. Apache Maven promotes the use of dependencies via a - standardized coordinates system, binary plugins, and a standard build - lifecycle. + libraries that provide a widely-used project build tool, targeting mainly Java + development. Apache Maven promotes the use of dependencies via a + standardized coordinates system, binary plugins, and a standard build + lifecycle. @@ -1170,5 +1220,19 @@ under the License. + + rewrite + + true + + + + + org.openrewrite.maven + rewrite-maven-plugin + + + +