-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6ca372
commit 8ac4923
Showing
12 changed files
with
463 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
invoker.goals=site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<project> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>localhost</groupId> | ||
<artifactId>dummy-parent3</artifactId> | ||
<version>1.0.0</version> | ||
</parent> | ||
|
||
<artifactId>module</artifactId> | ||
<version>1.0.0</version> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.3</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>@sitePluginVersion@</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<reporting> | ||
<excludeDefaults>true</excludeDefaults> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<reportSets> | ||
<reportSet> | ||
<reports> | ||
<report>parent-updates-report</report> | ||
</reports> | ||
</reportSet> | ||
</reportSets> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<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-parent2</artifactId> | ||
<version>1.0</version> | ||
</parent> | ||
|
||
<artifactId>it-parent-updates-report-001</artifactId> | ||
<version>1.0.0</version> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>module</module> | ||
</modules> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.3</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>@sitePluginVersion@</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<reporting> | ||
<excludeDefaults>true</excludeDefaults> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<reportSets> | ||
<reportSet> | ||
<reports> | ||
<report>parent-updates-report</report> | ||
</reports> | ||
</reportSet> | ||
</reportSets> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<project> | ||
<skin> | ||
<groupId>org.apache.maven.skins</groupId> | ||
<artifactId>maven-default-skin</artifactId> | ||
<version>1.0</version> | ||
</skin> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
report = new File( basedir, "target/site/parent-updates-report.html" ).text | ||
.replaceAll( "<[^>]+>", " " ) | ||
.replaceAll( "&[^;]+;", " " ) | ||
.replaceAll( "\\s+", " " ) | ||
|
||
assert report =~ /dummy-parent2 +1.0 +pom +3.1/ | ||
|
||
report = new File( basedir, "module/target/site/parent-updates-report.html" ).text | ||
.replaceAll( "<[^>]+>", " " ) | ||
.replaceAll( "&[^;]+;", " " ) | ||
.replaceAll( "\\s+", " " ) | ||
|
||
assert report =~ /dummy-parent3 +1.0.0 +pom/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
145 changes: 145 additions & 0 deletions
145
src/main/java/org/codehaus/mojo/versions/ParentUpdatesReport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
package org.codehaus.mojo.versions; | ||
|
||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import javax.inject.Inject; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Map; | ||
|
||
import org.apache.maven.artifact.manager.WagonManager; | ||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; | ||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource; | ||
import org.apache.maven.artifact.resolver.ArtifactResolver; | ||
import org.apache.maven.doxia.sink.Sink; | ||
import org.apache.maven.model.Dependency; | ||
import org.apache.maven.plugins.annotations.Mojo; | ||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.apache.maven.plugins.annotations.ResolutionScope; | ||
import org.apache.maven.project.MavenProject; | ||
import org.apache.maven.reporting.MavenReportException; | ||
import org.apache.maven.repository.RepositorySystem; | ||
import org.codehaus.mojo.versions.api.ArtifactVersions; | ||
import org.codehaus.mojo.versions.utils.DependencyBuilder; | ||
import org.codehaus.plexus.i18n.I18N; | ||
|
||
import static java.util.Collections.emptyMap; | ||
import static java.util.Collections.singletonMap; | ||
|
||
/** | ||
* Generates a report on available updates for parent artifacts | ||
* | ||
* @author Andrzej Jarmoniuk | ||
* @since 2.13.0 | ||
*/ | ||
@Mojo( name = "parent-updates-report", | ||
requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = false ) | ||
public class ParentUpdatesReport extends AbstractVersionsReport | ||
{ | ||
@Parameter( defaultValue = "${reactorProjects}", required = true, readonly = true ) | ||
protected List<MavenProject> reactorProjects; | ||
|
||
@Inject | ||
protected ParentUpdatesReport( I18N i18n, RepositorySystem repositorySystem, ArtifactResolver artifactResolver, | ||
ArtifactMetadataSource artifactMetadataSource, WagonManager wagonManager ) | ||
{ | ||
super( i18n, repositorySystem, artifactResolver, artifactMetadataSource, wagonManager ); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public boolean isExternalReport() | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public boolean canGenerateReport() | ||
{ | ||
if ( getProject().getParent() == null ) | ||
{ | ||
getLog().warn( "Project does not have a parent." ); | ||
return false; | ||
} | ||
|
||
if ( reactorProjects.contains( getProject().getParent() ) ) | ||
{ | ||
getLog().warn( "Parent project is part of the reactor." ); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* generates an empty report in case there are no sources to generate a report with | ||
* | ||
* @param locale the locale to generate the report for. | ||
* @param sink the report formatting tool | ||
*/ | ||
@SuppressWarnings( "deprecation" ) | ||
protected void doGenerateReport( Locale locale, Sink sink ) throws MavenReportException | ||
{ | ||
try | ||
{ | ||
ArtifactVersions artifactVersions = getHelper().lookupArtifactVersions( project.getParentArtifact(), | ||
false ); | ||
artifactVersions.setIncludeSnapshots( allowSnapshots ); | ||
Dependency parent = DependencyBuilder.newBuilder() | ||
.withGroupId( artifactVersions.getGroupId() ) | ||
.withArtifactId( artifactVersions.getArtifactId() ) | ||
.withVersion( artifactVersions.getArtifact().getVersion() ) | ||
.withScope( artifactVersions.getArtifact().getScope() ) | ||
.withType( artifactVersions.getArtifact().getType() ) | ||
.withClassifier( artifactVersions.getArtifact().getClassifier() ) | ||
.build(); | ||
new DependencyUpdatesRenderer( sink, getI18n(), getOutputName(), locale, | ||
singletonMap( parent, artifactVersions ), emptyMap() ) | ||
{ | ||
@Override | ||
protected void renderSummaryTotalsTable( Map<Dependency, ArtifactVersions> allUpdates ) | ||
{ | ||
} | ||
|
||
@Override | ||
protected void renderDependencyManagementSummary() | ||
{ | ||
} | ||
} | ||
.renderBody(); | ||
} | ||
catch ( ArtifactMetadataRetrievalException e ) | ||
{ | ||
throw new MavenReportException( e.getMessage(), e ); | ||
} | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public String getOutputName() | ||
{ | ||
return "parent-updates-report"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
report.title=Parent Updates Report | ||
report.description=Provides information on parent artifact updates | ||
report.overview.title=Overview | ||
report.overview.text=This report summarizes newer versions that may be available for your project's parent artifacts | ||
report.overview.dependency=Parent artifact | ||
report.overview.noDependency=This project does not declare a parent artifact | ||
report.overview.numUpToDate=# of parent artifacts using the latest version available | ||
report.overview.numNewerMajorAvailable=# of parent artifacts where the next version available is a major version update | ||
report.overview.numNewerMinorAvailable=# of parent artifacts where the next version available is a minor version update | ||
report.overview.numNewerIncrementalAvailable=# of parent artifacts where the next version available is an incremental \ | ||
version update | ||
report.overview.numNewerVersionAvailable=# of parent artifacts where the next version available is smaller than an \ | ||
incremental version update | ||
report.overview.property=Summary of parent artifacts associated with artifact versions | ||
report.overview.noProperty=No properties associated with artifacts have been defined. | ||
report.detail.title=Parent Update | ||
report.detail.text= | ||
report.status=Status | ||
report.groupId=Group Id | ||
report.artifactId=Artifact Id | ||
report.currentVersion=Current Version | ||
report.scope=Scope | ||
report.classifier=Classifier | ||
report.type=Type | ||
report.nextVersion=Next Version | ||
report.latestSubIncremental=Latest Subincremental | ||
report.nextIncremental=Next Incremental | ||
report.latestIncremental=Latest Incremental | ||
report.nextMinor=Next Minor | ||
report.latestMinor=Latest Minor | ||
report.nextMajor=Next Major | ||
report.latestMajor=Latest Major | ||
report.updateVersions=Newer versions | ||
report.noUpdatesAvailable=No newer versions available. | ||
report.otherUpdatesAvailable=There is at least one newer version available. | ||
report.incrementalUpdatesAvailable=There is at least one newer incremental version available. \ | ||
Incremental updates are typically passive. | ||
report.minorUpdatesAvailable=There is at least one newer minor version available. \ | ||
Minor updates are sometimes passive. | ||
report.majorUpdatesAvailable=There is at least one newer major version available. \ | ||
Major updates are rarely passive. |
Oops, something went wrong.