diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
index 04483dad..8f6a7943 100644
--- a/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
+++ b/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java
@@ -460,7 +460,7 @@ private String determineRulesetFilename( String ruleset )
{
String result = ruleset.trim();
String lowercase = result.toLowerCase( Locale.ROOT );
- if ( lowercase.endsWith( ".xml" ) )
+ if ( lowercase.startsWith( "http://" ) || lowercase.startsWith( "https://" ) || lowercase.endsWith( ".xml" ) )
{
return result;
}
diff --git a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
index 93f9f885..db8f94f9 100644
--- a/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
+++ b/src/test/java/org/apache/maven/plugins/pmd/PmdReportTest.java
@@ -719,6 +719,8 @@ public void testPmdReportResolveRulesets()
final String sonarExportRulesetUrl = "http://localhost:" + mockServer.port() + sonarProfileUrl;
final String myRulesetBaseUrl = "/config/my-ruleset.xml";
final String myRulesetUrl = "http://localhost:" + mockServer.port() + myRulesetBaseUrl;
+ final String notAInternalRulesetBaseUrl = "/projects/OURPROJECT/repos/ourproject-pmd/raw/InProgressRuleset.xml?at=refs%2Fheads%2Fmaster";
+ final String notAInternalRulesetUrl = "http://localhost:" + mockServer.port() + notAInternalRulesetBaseUrl;
WireMock.configureFor( "localhost", port );
WireMock.stubFor( WireMock.get( WireMock.urlEqualTo( sonarProfileUrl ) )
@@ -727,6 +729,9 @@ public void testPmdReportResolveRulesets()
WireMock.stubFor( WireMock.get( WireMock.urlEqualTo( myRulesetBaseUrl ) )
.willReturn( WireMock.aResponse().withStatus( 200 ).withHeader( "Content-Type",
"text/xml" ).withBody( sonarRuleset ) ) );
+ WireMock.stubFor( WireMock.get( WireMock.urlEqualTo( notAInternalRulesetBaseUrl ) )
+ .willReturn( WireMock.aResponse().withStatus( 200 ).withHeader( "Content-Type",
+ "text/xml" ).withBody( sonarRuleset ) ) );
FileUtils.copyDirectoryStructure( new File( getBasedir(),
"src/test/resources/unit/default-configuration/jxr-files" ),
@@ -738,6 +743,7 @@ public void testPmdReportResolveRulesets()
PmdReport mojo = (PmdReport) lookupMojo( "pmd", testPom );
mojo.rulesets[3] = sonarExportRulesetUrl;
mojo.rulesets[4] = myRulesetUrl;
+ mojo.rulesets[5] = notAInternalRulesetUrl;
mojo.execute();
// these are the rulesets, that have been copied to target/pmd/rulesets
@@ -756,6 +762,9 @@ public void testPmdReportResolveRulesets()
generatedFile = new File( getBasedir(), "target/test/unit/default-configuration/target/pmd/rulesets/my-ruleset.xml" );
assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+ generatedFile = new File( getBasedir(), "target/test/unit/default-configuration/target/pmd/rulesets/InProgressRuleset.xml_at_refs_2Fheads_2Fmaster.xml" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
mockServer.stop();
}
diff --git a/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml b/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml
index 5d4ea4b5..351ef8e4 100644
--- a/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml
+++ b/src/test/resources/unit/default-configuration/pmd-report-resolve-rulesets.xml
@@ -44,6 +44,7 @@ under the License.
http://localhost:12345/profiles/export?format=pmd&language=java&name=Sonar%2520way
http://localhost:12345/config/my-ruleset.xml
+ http://localhost:12345/projects/OURPROJECT/repos/ourproject-pmd/raw/InProgressRuleset.xml?at=refs%2Fheads%2Fmaster
xml
true