Merge branch 'jetty-9.4.x' into jetty-10.0.x

This commit is contained in:
olivier lamy 2021-01-26 18:26:18 +10:00
commit da7fd63d98
5 changed files with 36 additions and 80 deletions

View File

@ -532,14 +532,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- No point performing PMD in assembly project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<dependencies> <dependencies>

View File

@ -51,7 +51,7 @@ public class MavenLocalRepoFileInitializer extends FileInitializer
public String version; public String version;
public String type; public String type;
public String classifier; public String classifier;
private String mavenRepoUri = "https://repo1.maven.org/maven2/"; private String mavenRepoUri = DEFAULT_REMOTE_REPO;
public String toPath() public String toPath()
{ {
@ -102,6 +102,9 @@ public class MavenLocalRepoFileInitializer extends FileInitializer
} }
private final Path localRepositoryDir; private final Path localRepositoryDir;
private static final String DEFAULT_REMOTE_REPO = "https://repo1.maven.org/maven2/";
private final boolean readonly; private final boolean readonly;
private String mavenRepoUri; private String mavenRepoUri;
@ -223,6 +226,18 @@ public class MavenLocalRepoFileInitializer extends FileInitializer
return null; 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) public Coordinates getCoordinates(URI uri)
{ {
if (!"maven".equalsIgnoreCase(uri.getScheme())) if (!"maven".equalsIgnoreCase(uri.getScheme()))
@ -260,14 +275,7 @@ public class MavenLocalRepoFileInitializer extends FileInitializer
coords.version = parts[2]; coords.version = parts[2];
coords.type = "jar"; coords.type = "jar";
coords.classifier = null; coords.classifier = null;
if (this.mavenRepoUri != null) coords.mavenRepoUri = getRemoteUri();
{
coords.mavenRepoUri = this.mavenRepoUri;
}
else
{
coords.mavenRepoUri = System.getProperty("maven.repo.uri", coords.mavenRepoUri);
}
if (parts.length >= 4) if (parts.length >= 4)
{ {

View File

@ -94,7 +94,7 @@ public class MavenLocalRepoFileInitializerTest
assertThat("coords.classifier", coords.classifier, nullValue()); assertThat("coords.classifier", coords.classifier, nullValue());
assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), 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 @Test
@ -112,7 +112,7 @@ public class MavenLocalRepoFileInitializerTest
assertThat("coords.classifier", coords.classifier, nullValue()); assertThat("coords.classifier", coords.classifier, nullValue());
assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), 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 @Test
@ -130,7 +130,7 @@ public class MavenLocalRepoFileInitializerTest
assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.classifier", coords.classifier, is("tests"));
assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), 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 @Test
@ -148,7 +148,7 @@ public class MavenLocalRepoFileInitializerTest
assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.classifier", coords.classifier, is("tests"));
assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), 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 @Test
@ -168,7 +168,7 @@ public class MavenLocalRepoFileInitializerTest
assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.classifier", coords.classifier, is("tests"));
assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), 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 @Test
@ -188,7 +188,7 @@ public class MavenLocalRepoFileInitializerTest
assertThat("coords.classifier", coords.classifier, is("tests")); assertThat("coords.classifier", coords.classifier, is("tests"));
assertThat("coords.toCentralURI", coords.toCentralURI().toASCIIString(), 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"); Path destination = testdir.getEmptyPathDir().resolve("jetty-http-9.4.31.v20200723-tests.jar");
Files.deleteIfExists(destination); Files.deleteIfExists(destination);

56
pom.xml
View File

@ -59,9 +59,6 @@
<maven.install.plugin.version>3.0.0-M1</maven.install.plugin.version> <maven.install.plugin.version>3.0.0-M1</maven.install.plugin.version>
<maven.deploy.plugin.version>3.0.0-M1</maven.deploy.plugin.version> <maven.deploy.plugin.version>3.0.0-M1</maven.deploy.plugin.version>
<pmd.verbose>true</pmd.verbose>
<pmd.skip>false</pmd.skip>
<!-- testing --> <!-- testing -->
<it.debug>false</it.debug> <it.debug>false</it.debug>
<jetty.test.version>5.5</jetty.test.version> <jetty.test.version>5.5</jetty.test.version>
@ -271,39 +268,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<executions>
<execution>
<id>named-logging-enforcement</id>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<skip>${pmd.skip}</skip>
<verbose>${pmd.verbose}</verbose>
<printFailingErrors>${pmd.verbose}</printFailingErrors>
</configuration>
</execution>
</executions>
<configuration>
<linkXRef>false</linkXRef>
<targetJdk>11</targetJdk>
<rulesets>
<ruleset>jetty/pmd_logging_ruleset.xml</ruleset>
</rulesets>
<analysisCache>true</analysisCache>
<showPmdLog>false</showPmdLog>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-build-support</artifactId>
<version>${build-support.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
@ -633,11 +597,6 @@
<artifactId>maven-plugin-plugin</artifactId> <artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version> <version>3.6.0</version>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.14.0</version>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId> <artifactId>maven-project-info-reports-plugin</artifactId>
@ -962,19 +921,6 @@
<ignore /> <ignore />
</action> </action>
</pluginExecution> </pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<versionRange>[2.5,)</versionRange>
<goals>
<goal>check</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution> <pluginExecution>
<pluginExecutionFilter> <pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@ -1447,7 +1393,6 @@
<spotbugs.effort>Default</spotbugs.effort> <spotbugs.effort>Default</spotbugs.effort>
<spotbugs.skip>false</spotbugs.skip> <spotbugs.skip>false</spotbugs.skip>
<spotbugs.onlyAnalyze>org.eclipse.jetty.*</spotbugs.onlyAnalyze> <spotbugs.onlyAnalyze>org.eclipse.jetty.*</spotbugs.onlyAnalyze>
<pmd.verbose>false</pmd.verbose>
</properties> </properties>
<modules> <modules>
<module>javadoc</module> <module>javadoc</module>
@ -1637,7 +1582,6 @@
<id>fast</id> <id>fast</id>
<properties> <properties>
<skipTests>true</skipTests> <skipTests>true</skipTests>
<pmd.skip>true</pmd.skip>
<checkstyle.skip>true</checkstyle.skip> <checkstyle.skip>true</checkstyle.skip>
<enforcer.skip>true</enforcer.skip> <enforcer.skip>true</enforcer.skip>
<license.skip>true</license.skip> <license.skip>true</license.skip>

View File

@ -152,9 +152,21 @@ public class JettyHomeTester
commands.add("-Djava.io.tmpdir=" + workDir.toAbsolutePath().toString()); commands.add("-Djava.io.tmpdir=" + workDir.toAbsolutePath().toString());
commands.add("-jar"); commands.add("-jar");
commands.add(config.jettyHome.toAbsolutePath() + "/start.jar"); commands.add(config.jettyHome.toAbsolutePath() + "/start.jar");
// we get artifacts from local repo first
args = new ArrayList<>(args); args = new ArrayList<>(args);
args.add("maven.local.repo=" + config.mavenLocalRepository); 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); commands.addAll(args);
LOGGER.info("Executing: {}", commands); LOGGER.info("Executing: {}", commands);