From 4c515914078a4dfa9e06de5708dc1a940534d0ab Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 26 Jan 2021 02:17:29 -0600 Subject: [PATCH] Remove PMD from build (#5900) * Remove PMD from build Signed-off-by: Joakim Erdfelt * Attempt to fix log4j2 distribution test Signed-off-by: Joakim Erdfelt * Fixing jetty-start tests to use configured maven.repo.uri property Signed-off-by: Joakim Erdfelt * Using ${env.MAVEN_REPO_URI} configured at Jenkins. Signed-off-by: Joakim Erdfelt * no need of this Signed-off-by: olivier lamy Co-authored-by: olivier lamy --- aggregates/jetty-all-compact3/pom.xml | 12 ---- aggregates/jetty-websocket-all/pom.xml | 11 ---- jetty-distribution/pom.xml | 8 --- jetty-home/pom.xml | 8 --- .../MavenLocalRepoFileInitializer.java | 24 +++++--- .../MavenLocalRepoFileInitializerTest.java | 14 ++--- pom.xml | 56 ------------------- .../distribution/DistributionTester.java | 12 +++- 8 files changed, 33 insertions(+), 112 deletions(-) diff --git a/aggregates/jetty-all-compact3/pom.xml b/aggregates/jetty-all-compact3/pom.xml index 3481801ec236..22c9a95199b4 100644 --- a/aggregates/jetty-all-compact3/pom.xml +++ b/aggregates/jetty-all-compact3/pom.xml @@ -11,7 +11,6 @@ Jetty :: Aggregate :: All core Jetty suitable for Java 8 compact 3 profile ${project.groupId}.all.compact3 - true ${project.build.directory}/sources @@ -112,17 +111,6 @@ - - - - org.apache.maven.plugins - maven-pmd-plugin - - true - - - - diff --git a/aggregates/jetty-websocket-all/pom.xml b/aggregates/jetty-websocket-all/pom.xml index 6ef3b0ef5e43..b5fb6dafee69 100644 --- a/aggregates/jetty-websocket-all/pom.xml +++ b/aggregates/jetty-websocket-all/pom.xml @@ -90,17 +90,6 @@ - - - - org.apache.maven.plugins - maven-pmd-plugin - - true - - - - diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index 84329acb16ef..c40daeebb734 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -377,14 +377,6 @@ - - - org.apache.maven.plugins - maven-pmd-plugin - - true - - diff --git a/jetty-home/pom.xml b/jetty-home/pom.xml index d2f2b05ef1ed..5cacde854f29 100644 --- a/jetty-home/pom.xml +++ b/jetty-home/pom.xml @@ -531,14 +531,6 @@ - - - org.apache.maven.plugins - maven-pmd-plugin - - true - - diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializer.java b/jetty-start/src/main/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializer.java index 68765b74284c..948be9dfb9e1 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializer.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializer.java @@ -56,7 +56,7 @@ public static class Coordinates public String version; public String type; public String classifier; - private String mavenRepoUri = "https://repo1.maven.org/maven2/"; + private String mavenRepoUri = DEFAULT_REMOTE_REPO; public String toPath() { @@ -80,6 +80,7 @@ public URI toCentralURI() } } + private static final String DEFAULT_REMOTE_REPO = "https://repo1.maven.org/maven2/"; private Path localRepositoryDir; private final boolean readonly; private String mavenRepoUri; @@ -157,6 +158,18 @@ private Path getLocalRepoFile(Coordinates coords) throws IOException return null; } + public String getRemoteUri() + { + if (this.mavenRepoUri != null) + { + return this.mavenRepoUri; + } + else + { + return System.getProperty("maven.repo.uri", DEFAULT_REMOTE_REPO); + } + } + public Coordinates getCoordinates(URI uri) { if (!"maven".equalsIgnoreCase(uri.getScheme())) @@ -194,14 +207,7 @@ public Coordinates getCoordinates(URI uri) coords.version = parts[2]; coords.type = "jar"; coords.classifier = null; - if (this.mavenRepoUri != null) - { - coords.mavenRepoUri = this.mavenRepoUri; - } - else - { - coords.mavenRepoUri = System.getProperty("maven.repo.uri", coords.mavenRepoUri); - } + coords.mavenRepoUri = getRemoteUri(); if (parts.length >= 4) { diff --git a/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java b/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java index 0abc8e444315..8e9481f7eddc 100644 --- a/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java +++ b/jetty-start/src/test/java/org/eclipse/jetty/start/fileinits/MavenLocalRepoFileInitializerTest.java @@ -94,7 +94,7 @@ public void testGetCoordinateNormal() assertThat("coords.classifier", coords.classifier, nullValue()); assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), - is("https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-start/9.3.x/jetty-start-9.3.x.jar")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-start/9.3.x/jetty-start-9.3.x.jar")); } @Test @@ -112,7 +112,7 @@ public void testGetCoordinateZip() assertThat("coords.classifier", coords.classifier, nullValue()); assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), - is("https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.3.x/jetty-distribution-9.3.x.zip")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-distribution/9.3.x/jetty-distribution-9.3.x.zip")); } @Test @@ -130,7 +130,7 @@ public void testGetCoordinateTestJar() assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), - is("https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.3.x/jetty-http-9.3.x-tests.jar")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-http/9.3.x/jetty-http-9.3.x-tests.jar")); } @Test @@ -148,7 +148,7 @@ public void testGetCoordinateTestUnspecifiedType() assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), - is("https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.3.x/jetty-http-9.3.x-tests.jar")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-http/9.3.x/jetty-http-9.3.x-tests.jar")); } @Test @@ -168,11 +168,11 @@ public void testGetCoordinateTestMavenBaseUri() assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), - is("https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.3.x/jetty-http-9.3.x-tests.jar")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-http/9.3.x/jetty-http-9.3.x-tests.jar")); } @Test - public void testDownloaddefaultrepo() + public void testDownloadUnspecifiedRepo() throws Exception { MavenLocalRepoFileInitializer repo = @@ -188,7 +188,7 @@ public void testDownloaddefaultrepo() assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), - is("https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-http/9.4.10.v20180503/jetty-http-9.4.10.v20180503-tests.jar")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-http/9.4.10.v20180503/jetty-http-9.4.10.v20180503-tests.jar")); Path destination = Paths.get(System.getProperty("java.io.tmpdir"), "jetty-http-9.4.10.v20180503-tests.jar"); Files.deleteIfExists(destination); diff --git a/pom.xml b/pom.xml index 4288b0c38da8..dcba57914737 100644 --- a/pom.xml +++ b/pom.xml @@ -58,9 +58,6 @@ 3.0.0-M1 3.0.0-M1 - true - false - false 5.5 @@ -255,39 +252,6 @@ - - maven-pmd-plugin - - - named-logging-enforcement - compile - - check - - - ${pmd.skip} - ${pmd.verbose} - ${pmd.verbose} - - - - - false - 1.8 - - jetty/pmd_logging_ruleset.xml - - true - false - - - - org.eclipse.jetty.toolchain - jetty-build-support - ${build-support.version} - - - org.apache.maven.plugins maven-release-plugin @@ -607,11 +571,6 @@ maven-plugin-plugin 3.6.0 - - org.apache.maven.plugins - maven-pmd-plugin - 3.14.0 - org.apache.maven.plugins maven-project-info-reports-plugin @@ -925,19 +884,6 @@ - - - org.apache.maven.plugins - maven-pmd-plugin - [2.5,) - - check - - - - - - org.apache.maven.plugins @@ -1389,7 +1335,6 @@ Default false org.eclipse.jetty.* - false aggregates/jetty-all @@ -1607,7 +1552,6 @@ fast true - true true true true diff --git a/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionTester.java b/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionTester.java index 77f741699933..6ba1e1856edd 100644 --- a/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionTester.java +++ b/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/DistributionTester.java @@ -152,9 +152,19 @@ public DistributionTester.Run start(List args) throws Exception commands.add("-Djava.io.tmpdir=" + workDir.toAbsolutePath().toString()); commands.add("-jar"); commands.add(config.jettyHome.toAbsolutePath() + "/start.jar"); - // we get artifacts from local repo first + args = new ArrayList<>(args); + + // we get artifacts from local repo first args.add("maven.local.repo=" + System.getProperty("mavenRepoPath")); + + // if this JVM has `maven.repo.uri` defined, make sure to propagate it to child + String remoteRepoUri = System.getProperty("maven.repo.uri"); + if (remoteRepoUri != null) + { + args.add("maven.repo.uri=" + remoteRepoUri); + } + commands.addAll(args); LOGGER.info("Executing: {}", commands);