You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/12/13 22:00:17 UTC
[maven-mvnd] branch master updated: Clean up some warnings during the build (#750)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git
The following commit(s) were added to refs/heads/master by this push:
new 25b51177 Clean up some warnings during the build (#750)
25b51177 is described below
commit 25b5117749f8276064ac68880683ea9adf31a785
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Tue Dec 13 23:00:11 2022 +0100
Clean up some warnings during the build (#750)
---
.../mvndaemon/mvnd/common/DaemonRegistryTest.java | 19 ++++++
.../maven/project/CachingProjectBuilder.java | 2 +-
.../mvndaemon/mvnd/builder/DependencyGraph.java | 11 +++-
.../org/mvndaemon/mvnd/builder/SmartBuilder.java | 3 +-
.../mvndaemon/mvnd/daemon/ClientDispatcher.java | 1 -
.../mvnd/interactivity/DaemonPrompter.java | 1 +
pom.xml | 77 ++--------------------
7 files changed, 35 insertions(+), 79 deletions(-)
diff --git a/common/src/test/java/org/mvndaemon/mvnd/common/DaemonRegistryTest.java b/common/src/test/java/org/mvndaemon/mvnd/common/DaemonRegistryTest.java
index 4f50732a..6ec7ef81 100644
--- a/common/src/test/java/org/mvndaemon/mvnd/common/DaemonRegistryTest.java
+++ b/common/src/test/java/org/mvndaemon/mvnd/common/DaemonRegistryTest.java
@@ -22,8 +22,10 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
+import java.io.PrintStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@@ -34,10 +36,27 @@ import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.UUID;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class DaemonRegistryTest {
+ private PrintStream oldSysErr;
+ private PrintStream newSysErr;
+
+ @BeforeEach
+ void setup() {
+ oldSysErr = System.err;
+ newSysErr = new PrintStream(new ByteArrayOutputStream());
+ System.setErr(newSysErr);
+ }
+
+ @AfterEach
+ void tearDown() {
+ System.setErr(oldSysErr);
+ }
+
@Test
public void testReadWrite() throws IOException {
Path temp = File.createTempFile("reg", ".data").toPath();
diff --git a/daemon/src/main/java/org/apache/maven/project/CachingProjectBuilder.java b/daemon/src/main/java/org/apache/maven/project/CachingProjectBuilder.java
index 6dc067bc..07c9a00b 100644
--- a/daemon/src/main/java/org/apache/maven/project/CachingProjectBuilder.java
+++ b/daemon/src/main/java/org/apache/maven/project/CachingProjectBuilder.java
@@ -652,7 +652,7 @@ public class CachingProjectBuilder implements ProjectBuilder {
return noErrors;
}
- @SuppressWarnings("checkstyle:methodlength")
+ @SuppressWarnings({"checkstyle:methodlength", "deprecation"})
private void initProject(
MavenProject project,
Map<File, MavenProject> projects,
diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/builder/DependencyGraph.java b/daemon/src/main/java/org/mvndaemon/mvnd/builder/DependencyGraph.java
index a8d7ad2f..e20aaf58 100644
--- a/daemon/src/main/java/org/mvndaemon/mvnd/builder/DependencyGraph.java
+++ b/daemon/src/main/java/org/mvndaemon/mvnd/builder/DependencyGraph.java
@@ -49,10 +49,15 @@ public class DependencyGraph<K> {
private final Map<K, Set<K>> transitiveUpstreams;
private final Map<K, List<K>> downstreams;
+ @SuppressWarnings("unchecked")
public static DependencyGraph<MavenProject> fromMaven(MavenSession session) {
-
- final ProjectDependencyGraph graph = session.getProjectDependencyGraph();
- return fromMaven(graph);
+ Map<String, Object> data = session.getRequest().getData();
+ DependencyGraph<MavenProject> graph = (DependencyGraph<MavenProject>) data.get(DependencyGraph.class.getName());
+ if (graph == null) {
+ graph = fromMaven(session.getProjectDependencyGraph());
+ data.put(DependencyGraph.class.getName(), graph);
+ }
+ return graph;
}
static DependencyGraph<MavenProject> fromMaven(ProjectDependencyGraph graph) {
diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/builder/SmartBuilder.java b/daemon/src/main/java/org/mvndaemon/mvnd/builder/SmartBuilder.java
index f6410f6f..fad26e32 100644
--- a/daemon/src/main/java/org/mvndaemon/mvnd/builder/SmartBuilder.java
+++ b/daemon/src/main/java/org/mvndaemon/mvnd/builder/SmartBuilder.java
@@ -99,8 +99,7 @@ public class SmartBuilder implements Builder {
session.getRepositorySession().getData().set(ReactorBuildStatus.class, reactorBuildStatus);
- DependencyGraph<MavenProject> graph =
- (DependencyGraph<MavenProject>) session.getRequest().getData().get(DependencyGraph.class.getName());
+ DependencyGraph<MavenProject> graph = DependencyGraph.fromMaven(session);
// log overall build info
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/ClientDispatcher.java b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/ClientDispatcher.java
index eda1c5cd..b44289a0 100644
--- a/daemon/src/main/java/org/mvndaemon/mvnd/daemon/ClientDispatcher.java
+++ b/daemon/src/main/java/org/mvndaemon/mvnd/daemon/ClientDispatcher.java
@@ -53,7 +53,6 @@ public class ClientDispatcher extends BuildEventListener {
final MavenSession session = event.getSession();
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
final DependencyGraph<MavenProject> dependencyGraph = DependencyGraph.fromMaven(session);
- session.getRequest().getData().put(DependencyGraph.class.getName(), dependencyGraph);
final int maxThreads =
degreeOfConcurrency == 1 ? 1 : dependencyGraph.computeMaxWidth(degreeOfConcurrency, 1000);
diff --git a/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java b/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java
index 75aa0d3f..f763a6d2 100644
--- a/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java
+++ b/daemon/src/main/java/org/mvndaemon/mvnd/interactivity/DaemonPrompter.java
@@ -61,6 +61,7 @@ public class DaemonPrompter extends AbstractInputHandler implements Prompter, In
}
@Override
+ @SuppressWarnings("unchecked")
public String prompt(String message, List possibleValues, String defaultReply) throws PrompterException {
return doPrompt(message, possibleValues, defaultReply, false);
}
diff --git a/pom.xml b/pom.xml
index ba243977..955aabbd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,7 +92,6 @@
<buildnumber-maven-plugin.version>3.0.0</buildnumber-maven-plugin.version>
<compiler.version>3.10.1</compiler.version>
<groovy-maven-plugin.version>2.1.0</groovy-maven-plugin.version>
- <license-maven-plugin.version>4.2.rc3</license-maven-plugin.version>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-install-plugin.version>3.1.0</maven-install-plugin.version>
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
@@ -335,65 +334,6 @@
</excludes>
</configuration>
</plugin>
- <plugin>
- <groupId>com.mycila</groupId>
- <artifactId>license-maven-plugin</artifactId>
- <version>${license-maven-plugin.version}</version>
- <configuration>
- <inlineHeader>Copyright ${project.inceptionYear} the original author or authors.
-
-Licensed 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
-
-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.</inlineHeader>
- <excludes>
- <exclude>**/*.adoc</exclude>
- <exclude>**/README.*</exclude>
- <exclude>**/.cache/**</exclude>
- <exclude>**/.gitkeep</exclude>
- <exclude>**/mvnd.properties.template</exclude>
- <exclude>**/m2.conf</exclude>
- <exclude>**/mvnd</exclude>
- <exclude>**/mvnDebug</exclude>
- <exclude>**/.mvn/maven.config</exclude>
- <exclude>**/.mvn/jvm.config</exclude>
- <exclude>.gitattributes/</exclude>
- <exclude>.git-blame-ignore-revs</exclude>
- <exclude>.mvn/maven.config</exclude>
- <exclude>.mvn/wrapper/</exclude>
- <exclude>LICENSE.txt</exclude>
- <exclude>NOTICE.txt</exclude>
- <exclude>mvnw</exclude>
- <exclude>mvnw.cmd</exclude>
- <exclude>pom.xml.versionsBackup</exclude>
- <exclude>**/*.so</exclude>
- <exclude>**/*.dll</exclude>
- <exclude>**/*.jnilib</exclude>
- <exclude>**/Makefile*</exclude>
- <exclude>**/docker/**</exclude>
- <exclude>**/*.tpl</exclude>
- </excludes>
- <mapping>
- <bash>SCRIPT_STYLE</bash>
- <groovy>SLASHSTAR_STYLE</groovy>
- <java>SLASHSTAR_STYLE</java>
- <mvn>SCRIPT_STYLE</mvn>
- <mvnd.sh>SCRIPT_STYLE</mvnd.sh>
- <mvns>SCRIPT_STYLE</mvns>
- <vbs>APOSTROPHE_STYLE</vbs>
- </mapping>
- <skipExistingHeaders>true</skipExistingHeaders>
- <!-- we want to keep third party license headers -->
- <failIfUnknown>true</failIfUnknown>
- </configuration>
- </plugin>
<plugin>
<groupId>ca.vanzyl.provisio.maven.plugins</groupId>
<artifactId>provisio-maven-plugin</artifactId>
@@ -474,6 +414,11 @@ limitations under the License.</inlineHeader>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.12.1</version>
+ </plugin>
</plugins>
</pluginManagement>
@@ -488,18 +433,6 @@ limitations under the License.</inlineHeader>
</execution>
</executions>
</plugin>
- <plugin>
- <groupId>com.mycila</groupId>
- <artifactId>license-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>format</goal>
- </goals>
- <phase>process-sources</phase>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>