Skip to content

Commit

Permalink
Remove PMD from build (#5900)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
joakime and olamy committed Jan 26, 2021
1 parent 1701b83 commit 4c51591
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 112 deletions.
12 changes: 0 additions & 12 deletions aggregates/jetty-all-compact3/pom.xml
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
11 changes: 0 additions & 11 deletions aggregates/jetty-websocket-all/pom.xml
Expand Up @@ -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>
Expand Down
8 changes: 0 additions & 8 deletions jetty-distribution/pom.xml
Expand Up @@ -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>

Expand Down
8 changes: 0 additions & 8 deletions jetty-home/pom.xml
Expand Up @@ -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>
Expand Down
Expand Up @@ -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()
{
Expand All @@ -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;
Expand Down Expand Up @@ -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()))
Expand Down Expand Up @@ -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)
{
Expand Down
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 =
Expand All @@ -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);
Expand Down
56 changes: 0 additions & 56 deletions pom.xml
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Expand Up @@ -152,9 +152,19 @@ public DistributionTester.Run start(List<String> 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);
Expand Down

0 comments on commit 4c51591

Please sign in to comment.