Remove PMD from build (#5900)

* Remove PMD from build

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

* Attempt to fix log4j2 distribution test

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

* Fixing jetty-start tests to use configured maven.repo.uri property

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

* Using ${env.MAVEN_REPO_URI} configured at Jenkins.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

* no need of this

Signed-off-by: olivier lamy <oliver.lamy@gmail.com>

Co-authored-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
Joakim Erdfelt 2021-01-26 02:17:29 -06:00 committed by GitHub
parent 1701b83fd5
commit 4c51591407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 112 deletions

View File

@ -11,7 +11,6 @@
<name>Jetty :: Aggregate :: All core Jetty suitable for Java 8 compact 3 profile</name>
<properties>
<bundle-symbolic-name>${project.groupId}.all.compact3</bundle-symbolic-name>
<pmd.skip>true</pmd.skip>
</properties>
<build>
<sourceDirectory>${project.build.directory}/sources</sourceDirectory>
@ -112,17 +111,6 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>

View File

@ -90,17 +90,6 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>

View File

@ -377,14 +377,6 @@
</execution>
</executions>
</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>
</build>

View File

@ -531,14 +531,6 @@
</execution>
</executions>
</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>
</build>
<dependencies>

View File

@ -56,7 +56,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()
{
@ -80,6 +80,7 @@ public class MavenLocalRepoFileInitializer extends FileInitializer
}
}
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 @@ 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()))
@ -194,14 +207,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)
{

View File

@ -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-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 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,11 +168,11 @@ 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
public void testDownloaddefaultrepo()
public void testDownloadUnspecifiedRepo()
throws Exception
{
MavenLocalRepoFileInitializer repo =
@ -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.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);

56
pom.xml
View File

@ -58,9 +58,6 @@
<maven.install.plugin.version>3.0.0-M1</maven.install.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 -->
<it.debug>false</it.debug>
<jetty.test.version>5.5</jetty.test.version>
@ -255,39 +252,6 @@
</execution>
</executions>
</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>1.8</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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
@ -607,11 +571,6 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.14.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
@ -925,19 +884,6 @@
<ignore />
</action>
</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>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
@ -1389,7 +1335,6 @@
<spotbugs.effort>Default</spotbugs.effort>
<spotbugs.skip>false</spotbugs.skip>
<spotbugs.onlyAnalyze>org.eclipse.jetty.*</spotbugs.onlyAnalyze>
<pmd.verbose>false</pmd.verbose>
</properties>
<modules>
<module>aggregates/jetty-all</module>
@ -1607,7 +1552,6 @@
<id>fast</id>
<properties>
<skipTests>true</skipTests>
<pmd.skip>true</pmd.skip>
<checkstyle.skip>true</checkstyle.skip>
<enforcer.skip>true</enforcer.skip>
<license.skip>true</license.skip>

View File

@ -152,9 +152,19 @@ public class DistributionTester
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);