Skip to content

Commit

Permalink
Fixed mojohaus#1184: Filtering out the extensions reported as plugins…
Browse files Browse the repository at this point in the history
… by Maven
  • Loading branch information
andrzejj0 committed Nov 15, 2024
1 parent 1aaa4dc commit f39bc88
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:display-plugin-updates
invoker.mavenOpts = -Dversions.outputFile=./output.txt -DoutputEncoding=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localhost</groupId>
<artifactId>it-display-extension-updates-002</artifactId>

<version>1.0</version>
<packaging>pom</packaging>

<build>
<extensions>
<extension>
<groupId>localhost</groupId>
<artifactId>dummy-api</artifactId>
<version>1.0</version>
</extension>
</extensions>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def output = new File( basedir, "output.txt").text
assert !(output =~ /\Qlocalhost:dummy-api\E\s*\.*\s*\Q1.0\E/)

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<extensions xmlns="http://maven.apache.org/EXTENSIONS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/EXTENSIONS/1.1.0 https://maven.apache.org/xsd/core-extensions-1.1.0.xsd">
<extension>
<groupId>localhost</groupId>
<artifactId>dummy-api</artifactId>
<version>1.0</version>
</extension>
</extensions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:display-plugin-updates
invoker.mavenOpts = -Dversions.outputFile=./output.txt -DoutputEncoding=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localhost</groupId>
<artifactId>it-display-extension-updates-002</artifactId>

<version>1.0</version>
<packaging>pom</packaging>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def output = new File( basedir, "output.txt").text
assert !(output =~ /\Qlocalhost:dummy-api\E\s*\.*\s*\Q1.0\E/)

Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,8 @@ private static Stream<Plugin> getPluginManagementPlugins(BuildBase buildBase) {

private static Stream<Plugin> getBuildPlugins(BuildBase buildBase, Map<String, String> parentPluginManagement) {
return buildBase.getPlugins().stream()
// apparently, core and build extensions are seen as plugins with a null goal, so let's filter them out
.filter(plugin -> plugin.getGoals() != null)
// removing plugins without a version
// and with the parent also not defining it for them
.filter(plugin -> plugin.getVersion() != null || parentPluginManagement.get(plugin.getKey()) == null);
Expand Down

0 comments on commit f39bc88

Please sign in to comment.