Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#333: aggregated reports #836

Merged
merged 1 commit into from Dec 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -663,8 +663,10 @@ else if ( !excludePropertiesList.isEmpty() && excludePropertiesList.contains( pr
+ builder.getVersionRange() );
property.setVersion( builder.getVersionRange() );
}
versions.setCurrentVersion( request.getMavenProject().getProperties()
.getProperty( property.getName() ) );
final String currentVersion = request.getMavenProject().getProperties()
.getProperty( property.getName() );
versions.setCurrentVersion( currentVersion );
property.setValue( currentVersion );
propertyVersions.put( property, versions );
}
catch ( VersionRetrievalException e )
Expand Down
Expand Up @@ -46,6 +46,13 @@ public class Property
*/
private String version;

/**
* Used by {@link org.codehaus.mojo.versions.utils.PropertyComparator} when comparing two same named properties
*
* @since 2.14.0
*/
private String value;

/**
* Whether to automatically link dependencies to the property.
*
Expand Down Expand Up @@ -105,6 +112,7 @@ public Property( String name )
this.searchReactor = true;
this.preferReactor = true;
this.version = null;
this.value = null;
}

public String getName()
Expand Down Expand Up @@ -176,4 +184,14 @@ public void setBanSnapshots( boolean banSnapshots )
{
this.banSnapshots = banSnapshots;
}

public String getValue()
MihaStemberger marked this conversation as resolved.
Show resolved Hide resolved
{
return value;
}

public void setValue( String value )
{
this.value = value;
}
}
Expand Up @@ -20,7 +20,6 @@
*/

import java.util.Comparator;

import org.apache.commons.lang3.StringUtils;
import org.codehaus.mojo.versions.api.Property;

Expand All @@ -42,14 +41,18 @@ public enum PropertyComparator implements Comparator<Property>
* @see java.util.Comparator#compare(Object, Object)
* @since 1.0-beta-1
*/
@SuppressWarnings( "checkstyle:InnerAssignment" )
public int compare( Property p1, Property p2 )
{
int r;
return p1 == p2
? 0
: p1 == null
? 1
: p2 == null
? -1
: StringUtils.compare( p1.getName(), p2.getName() );
? 1
: p2 == null
? -1
: ( r = StringUtils.compare( p1.getName(), p2.getName() ) ) == 0
? StringUtils.compare( p1.getValue(), p2.getValue() )
MihaStemberger marked this conversation as resolved.
Show resolved Hide resolved
: r ;
}
}
38 changes: 38 additions & 0 deletions versions-maven-plugin/src/it-repo/dummy-aggregate-child-333.pom
@@ -0,0 +1,38 @@
<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>

<parent>
<groupId>localhost</groupId>
<artifactId>dummy-aggregate-parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
</parent>

<groupId>localhost</groupId>
<artifactId>dummy-aggregate-child</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<version.dummy-lib>2.0.0.0</version.dummy-lib>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>test.bigversion</groupId>
<artifactId>dummy-lib</artifactId>
<version>${version.dummy-lib}</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>test.package</groupId>
<artifactId>module</artifactId>
<version>0.0.2.19</version>
</dependency>
</dependencies>

</project>
33 changes: 33 additions & 0 deletions versions-maven-plugin/src/it-repo/dummy-aggregate-parent-333.pom
@@ -0,0 +1,33 @@
<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>dummy-aggregate-parent</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<properties>
<version.maven-clean-plugin>3.0.0</version.maven-clean-plugin>
</properties>

<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${version.maven-clean-plugin}</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<reporting>
<excludeDefaults>true</excludeDefaults>
</reporting>

</project>
@@ -0,0 +1,25 @@
<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>

<parent>
<groupId>localhost</groupId>
<artifactId>it-dependency-updates-aggregate-report-333</artifactId>
<version>1.0</version>
</parent>

<groupId>localhost</groupId>
<artifactId>it-dependency-updates-aggregate-report-333-child-one</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<url>http://localhost/</url>

<dependencies>
<dependency>
<groupId>test.bigversion</groupId>
<artifactId>dummy-lib</artifactId>
<version>3.0.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
@@ -0,0 +1,17 @@
<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>

<parent>
<groupId>localhost</groupId>
<artifactId>it-dependency-updates-aggregate-report-333</artifactId>
<version>1.0</version>
</parent>

<groupId>localhost</groupId>
<artifactId>it-dependency-updates-aggregate-report-333-child-two</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<url>http://localhost/</url>

</project>
@@ -0,0 +1 @@
invoker.goals=site
@@ -0,0 +1,68 @@
<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>

<parent>
<groupId>localhost</groupId>
<artifactId>dummy-aggregate-child</artifactId>
<version>1.0.1-SNAPSHOT</version>
</parent>

<groupId>localhost</groupId>
<artifactId>it-dependency-updates-aggregate-report-333</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<url>http://localhost/</url>


<dependencyManagement>
<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>dummy-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>localhost</groupId>
<artifactId>dummy-impl</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>@sitePluginVersion@</version>
</plugin>
</plugins>
</pluginManagement>
</build>


<reporting>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<inherited>false</inherited>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-aggregate-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

<modules>
<module>child-one</module>
<module>child-two</module>
</modules>

</project>
@@ -0,0 +1,7 @@
<project>
<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-default-skin</artifactId>
<version>1.0</version>
</skin>
</project>
@@ -0,0 +1,15 @@
output = new File( basedir, 'target/site/dependency-updates-aggregate-report.html' ).text
.replaceAll( '<[^>]+>', ' ' )
.replaceAll( '&[^;]+;', ' ' )
.replaceAll( '\\s+', ' ' )

// Dependency management
assert !( output =~ 'This project does not declare any dependencies in a dependencyManagement section.' )
assert ( output =~ 'localhost dummy-api 1.1 jar' )
assert ( output =~ 'localhost dummy-impl 1.1 jar' )
assert ( output =~ 'test.bigversion dummy-lib 2.0.0.0 jar' )

// Dependencies
assert !( output =~ 'This project does not declare any dependencies.' )
assert ( output =~ 'test.bigversion dummy-lib 3.0.0.0-SNAPSHOT compile jar' )
assert ( output =~ 'test.package module 0.0.2.19 compile jar' )
@@ -0,0 +1,28 @@
<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>

<parent>
<groupId>localhost</groupId>
<artifactId>it-plugin-updates-aggregate-report-333</artifactId>
<version>1.0</version>
</parent>

<groupId>localhost</groupId>
<artifactId>it-plugin-updates-aggregate-report-333-child-one</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>dependency-updates-report</name>
<url>http://localhost/</url>

<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version>
</plugin>
</plugins>
</build>


</project>
@@ -0,0 +1,25 @@
<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>

<parent>
<groupId>localhost</groupId>
<artifactId>it-plugin-updates-aggregate-report-333</artifactId>
<version>1.0</version>
</parent>

<groupId>localhost</groupId>
<artifactId>it-plugin-updates-aggregate-report-333-child-two</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<url>http://localhost/</url>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
@@ -0,0 +1 @@
invoker.goals=site