diff --git a/jetty-home/pom.xml b/jetty-home/pom.xml index a820bd8c691..225f6a19511 100644 --- a/jetty-home/pom.xml +++ b/jetty-home/pom.xml @@ -532,14 +532,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 e1efb2c0bd0..7501fc21105 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 @@ -51,7 +51,7 @@ public class MavenLocalRepoFileInitializer extends FileInitializer 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() { @@ -102,6 +102,9 @@ public class MavenLocalRepoFileInitializer extends FileInitializer } private final Path localRepositoryDir; + + private static final String DEFAULT_REMOTE_REPO = "https://repo1.maven.org/maven2/"; + private final boolean readonly; private String mavenRepoUri; @@ -223,6 +226,18 @@ public class MavenLocalRepoFileInitializer extends FileInitializer 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())) @@ -260,14 +275,7 @@ public class MavenLocalRepoFileInitializer extends FileInitializer 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 4030f5976ab..ce66e7d88ce 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 class MavenLocalRepoFileInitializerTest 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 class MavenLocalRepoFileInitializerTest assertThat("coords.classifier", coords.classifier, nullValue()); assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), - is("https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/10.0.0/jetty-home-10.0.0.zip")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-home/10.0.0/jetty-home-10.0.0.zip")); } @Test @@ -130,7 +130,7 @@ public class MavenLocalRepoFileInitializerTest 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 class MavenLocalRepoFileInitializerTest 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,7 +168,7 @@ public class MavenLocalRepoFileInitializerTest 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 @@ -188,7 +188,7 @@ public class MavenLocalRepoFileInitializerTest 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.31.v20200723/jetty-http-9.4.31.v20200723-tests.jar")); + is(repo.getRemoteUri() + "org/eclipse/jetty/jetty-http/9.4.31.v20200723/jetty-http-9.4.31.v20200723-tests.jar")); Path destination = testdir.getEmptyPathDir().resolve("jetty-http-9.4.31.v20200723-tests.jar"); Files.deleteIfExists(destination); diff --git a/pom.xml b/pom.xml index 17dcebfc24c..f75372de16f 100644 --- a/pom.xml +++ b/pom.xml @@ -59,9 +59,6 @@ 3.0.0-M1 3.0.0-M1 - true - false - false 5.5 @@ -271,39 +268,6 @@ - - maven-pmd-plugin - - - named-logging-enforcement - compile - - check - - - ${pmd.skip} - ${pmd.verbose} - ${pmd.verbose} - - - - - false - 11 - - jetty/pmd_logging_ruleset.xml - - true - false - - - - org.eclipse.jetty.toolchain - jetty-build-support - ${build-support.version} - - - org.apache.maven.plugins maven-release-plugin @@ -633,11 +597,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 @@ -962,19 +921,6 @@ - - - org.apache.maven.plugins - maven-pmd-plugin - [2.5,) - - check - - - - - - org.apache.maven.plugins @@ -1447,7 +1393,6 @@ Default false org.eclipse.jetty.* - false javadoc @@ -1637,7 +1582,6 @@ fast true - true true true true diff --git a/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/JettyHomeTester.java b/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/JettyHomeTester.java index 417ac7fe4b4..2a255f942ad 100644 --- a/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/JettyHomeTester.java +++ b/tests/test-distribution/src/main/java/org/eclipse/jetty/tests/distribution/JettyHomeTester.java @@ -152,9 +152,21 @@ public class JettyHomeTester 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); + args.add("maven.local.repo=" + config.mavenLocalRepository); + + // 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);