mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-11 13:39:32 +00:00
Clean up some warnings during the build (#750)
This commit is contained in:
@@ -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.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -34,10 +36,27 @@ import java.util.List;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import org.junit.jupiter.api.AfterEach;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class DaemonRegistryTest {
|
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
|
@Test
|
||||||
public void testReadWrite() throws IOException {
|
public void testReadWrite() throws IOException {
|
||||||
Path temp = File.createTempFile("reg", ".data").toPath();
|
Path temp = File.createTempFile("reg", ".data").toPath();
|
||||||
|
@@ -652,7 +652,7 @@ public class CachingProjectBuilder implements ProjectBuilder {
|
|||||||
return noErrors;
|
return noErrors;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("checkstyle:methodlength")
|
@SuppressWarnings({"checkstyle:methodlength", "deprecation"})
|
||||||
private void initProject(
|
private void initProject(
|
||||||
MavenProject project,
|
MavenProject project,
|
||||||
Map<File, MavenProject> projects,
|
Map<File, MavenProject> projects,
|
||||||
|
@@ -49,10 +49,15 @@ public class DependencyGraph<K> {
|
|||||||
private final Map<K, Set<K>> transitiveUpstreams;
|
private final Map<K, Set<K>> transitiveUpstreams;
|
||||||
private final Map<K, List<K>> downstreams;
|
private final Map<K, List<K>> downstreams;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static DependencyGraph<MavenProject> fromMaven(MavenSession session) {
|
public static DependencyGraph<MavenProject> fromMaven(MavenSession session) {
|
||||||
|
Map<String, Object> data = session.getRequest().getData();
|
||||||
final ProjectDependencyGraph graph = session.getProjectDependencyGraph();
|
DependencyGraph<MavenProject> graph = (DependencyGraph<MavenProject>) data.get(DependencyGraph.class.getName());
|
||||||
return fromMaven(graph);
|
if (graph == null) {
|
||||||
|
graph = fromMaven(session.getProjectDependencyGraph());
|
||||||
|
data.put(DependencyGraph.class.getName(), graph);
|
||||||
|
}
|
||||||
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DependencyGraph<MavenProject> fromMaven(ProjectDependencyGraph graph) {
|
static DependencyGraph<MavenProject> fromMaven(ProjectDependencyGraph graph) {
|
||||||
|
@@ -99,8 +99,7 @@ public class SmartBuilder implements Builder {
|
|||||||
|
|
||||||
session.getRepositorySession().getData().set(ReactorBuildStatus.class, reactorBuildStatus);
|
session.getRepositorySession().getData().set(ReactorBuildStatus.class, reactorBuildStatus);
|
||||||
|
|
||||||
DependencyGraph<MavenProject> graph =
|
DependencyGraph<MavenProject> graph = DependencyGraph.fromMaven(session);
|
||||||
(DependencyGraph<MavenProject>) session.getRequest().getData().get(DependencyGraph.class.getName());
|
|
||||||
|
|
||||||
// log overall build info
|
// log overall build info
|
||||||
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
|
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
|
||||||
|
@@ -53,7 +53,6 @@ public class ClientDispatcher extends BuildEventListener {
|
|||||||
final MavenSession session = event.getSession();
|
final MavenSession session = event.getSession();
|
||||||
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
|
final int degreeOfConcurrency = session.getRequest().getDegreeOfConcurrency();
|
||||||
final DependencyGraph<MavenProject> dependencyGraph = DependencyGraph.fromMaven(session);
|
final DependencyGraph<MavenProject> dependencyGraph = DependencyGraph.fromMaven(session);
|
||||||
session.getRequest().getData().put(DependencyGraph.class.getName(), dependencyGraph);
|
|
||||||
|
|
||||||
final int maxThreads =
|
final int maxThreads =
|
||||||
degreeOfConcurrency == 1 ? 1 : dependencyGraph.computeMaxWidth(degreeOfConcurrency, 1000);
|
degreeOfConcurrency == 1 ? 1 : dependencyGraph.computeMaxWidth(degreeOfConcurrency, 1000);
|
||||||
|
@@ -61,6 +61,7 @@ public class DaemonPrompter extends AbstractInputHandler implements Prompter, In
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public String prompt(String message, List possibleValues, String defaultReply) throws PrompterException {
|
public String prompt(String message, List possibleValues, String defaultReply) throws PrompterException {
|
||||||
return doPrompt(message, possibleValues, defaultReply, false);
|
return doPrompt(message, possibleValues, defaultReply, false);
|
||||||
}
|
}
|
||||||
|
77
pom.xml
77
pom.xml
@@ -92,7 +92,6 @@
|
|||||||
<buildnumber-maven-plugin.version>3.0.0</buildnumber-maven-plugin.version>
|
<buildnumber-maven-plugin.version>3.0.0</buildnumber-maven-plugin.version>
|
||||||
<compiler.version>3.10.1</compiler.version>
|
<compiler.version>3.10.1</compiler.version>
|
||||||
<groovy-maven-plugin.version>2.1.0</groovy-maven-plugin.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-jar-plugin.version>3.3.0</maven-jar-plugin.version>
|
||||||
<maven-install-plugin.version>3.1.0</maven-install-plugin.version>
|
<maven-install-plugin.version>3.1.0</maven-install-plugin.version>
|
||||||
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
|
<maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
|
||||||
@@ -335,65 +334,6 @@
|
|||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</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>
|
<plugin>
|
||||||
<groupId>ca.vanzyl.provisio.maven.plugins</groupId>
|
<groupId>ca.vanzyl.provisio.maven.plugins</groupId>
|
||||||
<artifactId>provisio-maven-plugin</artifactId>
|
<artifactId>provisio-maven-plugin</artifactId>
|
||||||
@@ -474,6 +414,11 @@ limitations under the License.</inlineHeader>
|
|||||||
<tagNameFormat>@{project.version}</tagNameFormat>
|
<tagNameFormat>@{project.version}</tagNameFormat>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<version>3.12.1</version>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
|
|
||||||
@@ -488,18 +433,6 @@ limitations under the License.</inlineHeader>
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</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>
|
<plugin>
|
||||||
<groupId>org.codehaus.gmavenplus</groupId>
|
<groupId>org.codehaus.gmavenplus</groupId>
|
||||||
<artifactId>gmavenplus-plugin</artifactId>
|
<artifactId>gmavenplus-plugin</artifactId>
|
||||||
|
Reference in New Issue
Block a user