This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-changes-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 863ca19 [MCHANGES-426] Require Maven 3.6.3, Doxia 2.x 863ca19 is described below commit 863ca19aebbb3969d6d209ebfdf2540ab872abe0 Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Wed Nov 20 09:02:07 2024 +0100 [MCHANGES-426] Require Maven 3.6.3, Doxia 2.x --- pom.xml | 172 +++++------------ .../pom.xml | 2 +- .../announce-generate-no-issue-management/pom.xml | 2 +- src/it/announce-generate-no-url/pom.xml | 2 +- src/it/announce-generate/pom.xml | 2 +- .../announcement-generate-custom-template/pom.xml | 2 +- .../report-aggregated-changes-generation/pom.xml | 4 +- src/it/report-changes-generation/pom.xml | 4 +- src/it/report-changes-interpolation/pom.xml | 4 +- src/it/report-changes-nofile/pom.xml | 9 +- src/it/report-changes-skip-snapshots/pom.xml | 9 +- .../pom.xml | 4 +- src/it/report-changes-system/pom.xml | 4 +- src/it/report-changes-system/verify.bsh | 2 +- src/it/report-jira-invalid-issuemanagement/pom.xml | 4 +- .../plugins/announcement/AnnouncementMojo.java | 2 +- .../plugins/changes/AbstractChangesReport.java | 168 +---------------- .../maven/plugins/changes/ChangesCheckMojo.java | 2 +- .../{ChangesMojo.java => ChangesReport.java} | 16 +- .../plugins/changes/ChangesReportGenerator.java | 12 +- .../maven/plugins/changes/FeedGenerator.java | 4 +- .../github/{GitHubMojo.java => GitHubReport.java} | 6 +- .../plugins/issues/IssuesReportGenerator.java | 3 +- .../maven/plugins/jira/AbstractJiraDownloader.java | 25 +-- .../jira/{JiraMojo.java => JiraReport.java} | 9 +- .../resource/loader/ProjectResourceLoader.java | 210 --------------------- .../trac/{TracMojo.java => TracReport.java} | 7 +- src/main/resources/META-INF/plexus/components.xml | 44 ----- src/site/site.xml | 7 + .../plugins/announcement/AnnouncementMojoTest.java | 2 +- .../{JiraMojoTest.java => JiraReportTest.java} | 6 +- .../maven/plugins/jira/JiraUnicodeTestCase.java | 36 +++- 32 files changed, 157 insertions(+), 628 deletions(-) diff --git a/pom.xml b/pom.xml index de302b7..913a4f3 100644 --- a/pom.xml +++ b/pom.xml @@ -73,11 +73,14 @@ under the License. <properties> <javaVersion>8</javaVersion> - <doxiaVersion>1.9.1</doxiaVersion> - <doxiaSitetoolsVersion>1.9.2</doxiaSitetoolsVersion> - <mavenVersion>3.0.5</mavenVersion> - <sitePluginVersion>3.3</sitePluginVersion> - <wagonVersion>2.4</wagonVersion> + <doxiaVersion>2.0.0</doxiaVersion> + <mavenVersion>3.6.3</mavenVersion> + <mavenResolverVersion>1.4.1</mavenResolverVersion> + <!-- TODO check with next parent --> + <version.maven-site-plugin>3.21.0</version.maven-site-plugin> + <version.maven-fluido-skin>2.0.0</version.maven-fluido-skin> + + <sitePluginVersion>${version.maven-site-plugin}</sitePluginVersion> <project.build.outputTimestamp>2020-04-07T21:04:00Z</project.build.outputTimestamp> </properties> @@ -123,41 +126,18 @@ under the License. <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-api</artifactId> - <version>3.0</version> + <version>4.0.0</version> </dependency> <dependency> <groupId>org.apache.maven.reporting</groupId> <artifactId>maven-reporting-impl</artifactId> - <version>2.3</version> - <exclusions> - <exclusion> - <groupId>org.apache.maven</groupId> - <artifactId>maven-project</artifactId> - </exclusion> - </exclusions> + <version>4.0.0</version> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-filtering</artifactId> <version>3.2.0</version> </dependency> - <dependency> - <groupId>org.apache.maven.shared</groupId> - <artifactId>maven-artifact-transfer</artifactId> - <version>0.13.1</version> - </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-interpolation</artifactId> - <version>1.26</version> - </dependency> - - <!-- wagon --> - <dependency> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-provider-api</artifactId> - <version>${wagonVersion}</version> - </dependency> <!-- plexus --> <dependency> @@ -208,21 +188,6 @@ under the License. </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-i18n</artifactId> - <version>1.0-beta-7</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-api</artifactId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> @@ -234,21 +199,7 @@ under the License. <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-velocity</artifactId> - <version>1.2</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-api</artifactId> - </exclusion> - <exclusion> - <groupId>velocity</groupId> - <artifactId>velocity</artifactId> - </exclusion> - </exclusions> + <version>2.2.0</version> </dependency> <!-- commons --> @@ -279,16 +230,6 @@ under the License. </dependency> <!-- doxia --> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-core</artifactId> - <version>${doxiaVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-module-xhtml</artifactId> - <version>${doxiaVersion}</version> - </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-sink-api</artifactId> @@ -296,23 +237,8 @@ under the License. </dependency> <dependency> <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-decoration-model</artifactId> - <version>${doxiaSitetoolsVersion}</version> - </dependency> - <dependency> - <groupId>org.apache.maven.doxia</groupId> - <artifactId>doxia-site-renderer</artifactId> - <version>${doxiaSitetoolsVersion}</version> - <exclusions> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-component-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-container-default</artifactId> - </exclusion> - </exclusions> + <artifactId>doxia-core</artifactId> + <version>${doxiaVersion}</version> </dependency> <!-- rest client for jira --> @@ -324,23 +250,12 @@ under the License. <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> - <version>2.1.0</version> + <version>2.18.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> - <version>2.12.7.1</version> - </dependency> - - <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity</artifactId> - <version>1.7</version> - </dependency> - <dependency> - <groupId>org.apache.velocity</groupId> - <artifactId>velocity-tools</artifactId> - <version>2.0</version> + <version>2.18.1</version> </dependency> <!-- trac dependencies --> @@ -354,23 +269,13 @@ under the License. <dependency> <groupId>org.eclipse.mylyn.github</groupId> <artifactId>org.eclipse.egit.github.core</artifactId> - <version>5.3.0.201903130848-r</version> + <version>2.1.5</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.10.1</version> </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - <version>4.2.3</version> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - <version>4.2.3</version> - </dependency> <!-- for rss feed generation --> <dependency> @@ -389,13 +294,13 @@ under the License. <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> - <version>2.28.2</version> + <version>4.11.0</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.maven.plugin-testing</groupId> <artifactId>maven-plugin-testing-harness</artifactId> - <version>2.1</version> + <version>3.3.0</version> <scope>test</scope> </dependency> <dependency> @@ -405,31 +310,38 @@ under the License. <scope>test</scope> </dependency> <dependency> - <groupId>org.sonatype.aether</groupId> - <artifactId>aether-connector-wagon</artifactId> - <version>1.13.1</version> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-connector-basic</artifactId> + <version>${mavenResolverVersion}</version> <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.maven.wagon</groupId> - <artifactId>wagon-http</artifactId> - <version>${wagonVersion}</version> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-transport-http</artifactId> + <version>${mavenResolverVersion}</version> <scope>test</scope> </dependency> </dependencies> - <repositories> - <repository> - <releases> - <enabled>true</enabled> - </releases> - <id>eclipse-egit</id> - <url>https://repo.eclipse.org/content/repositories/egit-releases/</url> - </repository> - </repositories> - <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <systemPropertyVariables> + <localRepository>${settings.localRepository}</localRepository> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </pluginManagement> <plugins> + <plugin> + <groupId>org.eclipse.sisu</groupId> + <artifactId>sisu-maven-plugin</artifactId> + </plugin> <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> @@ -575,7 +487,7 @@ under the License. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>l10n-maven-plugin</artifactId> - <version>1.0-alpha-2</version> + <version>1.1.0</version> <configuration> <excludes> <exclude>**/log4j.properties</exclude> diff --git a/src/it/announce-generate-inconsistent-issue-management/pom.xml b/src/it/announce-generate-inconsistent-issue-management/pom.xml index 85754a2..c6f8ff1 100644 --- a/src/it/announce-generate-inconsistent-issue-management/pom.xml +++ b/src/it/announce-generate-inconsistent-issue-management/pom.xml @@ -43,7 +43,7 @@ <url>http://localhost/bla</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> diff --git a/src/it/announce-generate-no-issue-management/pom.xml b/src/it/announce-generate-no-issue-management/pom.xml index 1ea8477..36c3476 100644 --- a/src/it/announce-generate-no-issue-management/pom.xml +++ b/src/it/announce-generate-no-issue-management/pom.xml @@ -40,7 +40,7 @@ </dependencies> <!-- no issue management --> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> diff --git a/src/it/announce-generate-no-url/pom.xml b/src/it/announce-generate-no-url/pom.xml index f34d3ac..2d5ccf0 100644 --- a/src/it/announce-generate-no-url/pom.xml +++ b/src/it/announce-generate-no-url/pom.xml @@ -43,7 +43,7 @@ <!-- no URL --> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> diff --git a/src/it/announce-generate/pom.xml b/src/it/announce-generate/pom.xml index 348b061..2a43b66 100644 --- a/src/it/announce-generate/pom.xml +++ b/src/it/announce-generate/pom.xml @@ -42,7 +42,7 @@ <url>http://localhost/bla</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> diff --git a/src/it/announcement-generate-custom-template/pom.xml b/src/it/announcement-generate-custom-template/pom.xml index dc80627..7e71bcd 100644 --- a/src/it/announcement-generate-custom-template/pom.xml +++ b/src/it/announcement-generate-custom-template/pom.xml @@ -42,7 +42,7 @@ <url>http://localhost</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> diff --git a/src/it/report-aggregated-changes-generation/pom.xml b/src/it/report-aggregated-changes-generation/pom.xml index 50ece24..f3b5cdb 100644 --- a/src/it/report-aggregated-changes-generation/pom.xml +++ b/src/it/report-aggregated-changes-generation/pom.xml @@ -41,7 +41,7 @@ <url>http://localhost/bla</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <modules> <module>module1</module> @@ -94,7 +94,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <configuration> <aggregated>true</aggregated> <issueLinkTemplatePerSystem> diff --git a/src/it/report-changes-generation/pom.xml b/src/it/report-changes-generation/pom.xml index 892e2a9..33a446a 100644 --- a/src/it/report-changes-generation/pom.xml +++ b/src/it/report-changes-generation/pom.xml @@ -41,7 +41,7 @@ <url>http://localhost/bla</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> @@ -89,7 +89,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <configuration> <issueLinkTemplatePerSystem> <jira>http://myjira/browse/%ISSUE%</jira> diff --git a/src/it/report-changes-interpolation/pom.xml b/src/it/report-changes-interpolation/pom.xml index c578462..e425f35 100644 --- a/src/it/report-changes-interpolation/pom.xml +++ b/src/it/report-changes-interpolation/pom.xml @@ -41,7 +41,7 @@ <url>http://localhost/bla</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> @@ -84,7 +84,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <configuration> <filteringChanges>true</filteringChanges> <issueLinkTemplatePerSystem> diff --git a/src/it/report-changes-nofile/pom.xml b/src/it/report-changes-nofile/pom.xml index ba10c45..5385b79 100644 --- a/src/it/report-changes-nofile/pom.xml +++ b/src/it/report-changes-nofile/pom.xml @@ -41,7 +41,7 @@ <url>http://localhost/bla</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> @@ -51,6 +51,11 @@ <artifactId>maven-changes-plugin</artifactId> <version>${changesPluginVersion}</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>@sitePluginVersion@</version> + </plugin> </plugins> </pluginManagement> <plugins> @@ -79,7 +84,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <configuration> <issueLinkTemplatePerSystem> <jira>http://myjira/browse/%ISSUE%</jira> diff --git a/src/it/report-changes-skip-snapshots/pom.xml b/src/it/report-changes-skip-snapshots/pom.xml index 9cf47a2..e35339a 100644 --- a/src/it/report-changes-skip-snapshots/pom.xml +++ b/src/it/report-changes-skip-snapshots/pom.xml @@ -41,7 +41,7 @@ <url>http://localhost/bla</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> @@ -51,6 +51,11 @@ <artifactId>maven-changes-plugin</artifactId> <version>${changesPluginVersion}</version> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>@sitePluginVersion@</version> + </plugin> </plugins> </pluginManagement> <plugins> @@ -79,7 +84,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <configuration> <issueLinkTemplatePerSystem> <jira>http://myjira/browse/%ISSUE%</jira> diff --git a/src/it/report-changes-system-noissuemanagement/pom.xml b/src/it/report-changes-system-noissuemanagement/pom.xml index 09ec388..69ce525 100644 --- a/src/it/report-changes-system-noissuemanagement/pom.xml +++ b/src/it/report-changes-system-noissuemanagement/pom.xml @@ -37,7 +37,7 @@ </dependency> </dependencies> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> @@ -80,7 +80,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <configuration> <issueLinkTemplatePerSystem> <default>http://myjira/browse/%ISSUE%</default> diff --git a/src/it/report-changes-system/pom.xml b/src/it/report-changes-system/pom.xml index e87e8af..abf9a65 100644 --- a/src/it/report-changes-system/pom.xml +++ b/src/it/report-changes-system/pom.xml @@ -41,7 +41,7 @@ <url>http://localhost</url> </issueManagement> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <build> <pluginManagement> @@ -87,7 +87,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <configuration> <issueLinkTemplatePerSystem> <jira>http://myjira/browse/%ISSUE%</jira> diff --git a/src/it/report-changes-system/verify.bsh b/src/it/report-changes-system/verify.bsh index 318921c..f40d27c 100644 --- a/src/it/report-changes-system/verify.bsh +++ b/src/it/report-changes-system/verify.bsh @@ -27,7 +27,7 @@ boolean result = true; try { - File report = new File( basedir, "target/site/changes-report.html" ); + File report = new File( basedir, "target/site/en/changes-report.html" ); if ( !report.exists() || report.isDirectory() ) { System.err.println( "report file is missing or a directory." ); diff --git a/src/it/report-jira-invalid-issuemanagement/pom.xml b/src/it/report-jira-invalid-issuemanagement/pom.xml index fb53f58..ea4ab6f 100644 --- a/src/it/report-jira-invalid-issuemanagement/pom.xml +++ b/src/it/report-jira-invalid-issuemanagement/pom.xml @@ -37,7 +37,7 @@ </dependency> </dependencies> <properties> - <changesPluginVersion>@pom.version@</changesPluginVersion> + <changesPluginVersion>@project.version@</changesPluginVersion> </properties> <issueManagement> <system>jira</system> @@ -84,7 +84,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-changes-plugin</artifactId> - <version>@pom.version@</version> + <version>@project.version@</version> <reportSets> <reportSet> <reports> diff --git a/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java b/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java index a2aa13a..4fd7a8f 100644 --- a/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java +++ b/src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java @@ -232,7 +232,7 @@ public class AnnouncementMojo extends AbstractAnnouncementMojo { /** * Velocity Component. */ - @Component(role = VelocityComponent.class, hint = "maven-changes-plugin") + @Component private VelocityComponent velocity; /** diff --git a/src/main/java/org/apache/maven/plugins/changes/AbstractChangesReport.java b/src/main/java/org/apache/maven/plugins/changes/AbstractChangesReport.java index 60249de..cc0bd4e 100644 --- a/src/main/java/org/apache/maven/plugins/changes/AbstractChangesReport.java +++ b/src/main/java/org/apache/maven/plugins/changes/AbstractChangesReport.java @@ -18,39 +18,9 @@ */ package org.apache.maven.plugins.changes; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; - -import org.apache.commons.io.IOUtils; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.doxia.site.decoration.Body; -import org.apache.maven.doxia.site.decoration.DecorationModel; -import org.apache.maven.doxia.site.decoration.Skin; -import org.apache.maven.doxia.siterenderer.Renderer; -import org.apache.maven.doxia.siterenderer.RendererException; -import org.apache.maven.doxia.siterenderer.RenderingContext; -import org.apache.maven.doxia.siterenderer.SiteRenderingContext; -import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink; import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.DefaultProjectBuildingRequest; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.reporting.AbstractMavenReport; -import org.apache.maven.reporting.MavenReportException; -import org.apache.maven.shared.transfer.artifact.DefaultArtifactCoordinate; -import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver; -import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException; -import org.codehaus.plexus.i18n.I18N; -import org.codehaus.plexus.util.ReaderFactory; /** * Base class with the things that should be in AbstractMavenReport anyway. Note: This file was copied from r415312 of @@ -67,24 +37,6 @@ public abstract class AbstractChangesReport extends AbstractMavenReport { @Parameter(property = "basedir", required = true) protected String basedir; - /** - * Report output directory. Note that this parameter is only relevant if the goal is run from the command line or - * from the default build lifecycle. If the goal is run indirectly as part of a site generation, the output - * directory configured in the Maven Site Plugin is used instead. - */ - @Parameter(defaultValue = "${project.reporting.outputDirectory}") - private File outputDirectory; - - /** - * Report output encoding. Note that this parameter is only relevant if the goal is run from the command line or - * from the default build lifecycle. If the goal is run indirectly as part of a site generation, the output encoding - * configured in the Maven Site Plugin is used instead. - * - * @since 2.4 - */ - @Parameter(property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}") - private String outputEncoding; - /** * This will cause the execution to be run only at the top of a given module tree. That is, run in the project * contained in the same folder where the mvn execution was launched. @@ -102,116 +54,6 @@ public abstract class AbstractChangesReport extends AbstractMavenReport { @Parameter(defaultValue = "${session}", readonly = true, required = true) protected MavenSession mavenSession; - /** - * Doxia Site Renderer. - */ - @Component - protected Renderer siteRenderer; - - /** - * The Maven Project. - */ - @Parameter(defaultValue = "${project}", readonly = true, required = true) - protected MavenProject project; - - /** - */ - @Component - protected ArtifactResolver resolver; - - /** - * Internationalization. - */ - @Component - protected I18N i18n; - - private Artifact getSkinArtifact() throws MojoExecutionException { - Skin skin = Skin.getDefaultSkin(); - DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate(); - coordinate.setGroupId(skin.getGroupId()); - coordinate.setArtifactId(skin.getArtifactId()); - coordinate.setVersion(skin.getVersion()); - ProjectBuildingRequest pbr = new DefaultProjectBuildingRequest(mavenSession.getProjectBuildingRequest()); - pbr.setRemoteRepositories(project.getRemoteArtifactRepositories()); - try { - return resolver.resolveArtifact(pbr, coordinate).getArtifact(); - } catch (ArtifactResolverException e) { - throw new MojoExecutionException("Couldn't resolve the skin.", e); - } - } - - public void execute() throws MojoExecutionException { - if (!canGenerateReport()) { - return; - } - - // TODO: push to a helper? Could still be improved by taking more of the site information from the site plugin - Writer writer = null; - try { - DecorationModel model = new DecorationModel(); - model.setBody(new Body()); - Map<String, String> attributes = new HashMap<>(); - attributes.put("outputEncoding", getOutputEncoding()); - Locale locale = Locale.getDefault(); - SiteRenderingContext siteContext = - siteRenderer.createContextForSkin(getSkinArtifact(), attributes, model, getName(locale), locale); - siteContext.setOutputEncoding(getOutputEncoding()); - - RenderingContext context = new RenderingContext(outputDirectory, getOutputName() + ".html"); - - SiteRendererSink sink = new SiteRendererSink(context); - generate(sink, null, locale); - - outputDirectory.mkdirs(); - - File file = new File(outputDirectory, getOutputName() + ".html"); - writer = new OutputStreamWriter(new FileOutputStream(file), getOutputEncoding()); - - siteRenderer.generateDocument(writer, sink, siteContext); - - writer.close(); - writer = null; - - siteRenderer.copyResources(siteContext, outputDirectory); - } catch (RendererException | IOException | MavenReportException e) { - throw new MojoExecutionException( - "An error has occurred in " + getName(Locale.ENGLISH) + " report generation.", e); - } finally { - IOUtils.closeQuietly(writer); - } - } - - /** - * @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory() - */ - protected String getOutputDirectory() { - return outputDirectory.getAbsolutePath(); - } - - /** - * Get the effective reporting output file encoding. - * - * @return The effective reporting output file encoding, never <code>null</code>. - * @since 2.4 - */ - protected String getOutputEncoding() { - return (outputEncoding != null) ? outputEncoding : ReaderFactory.UTF_8; - } - - /** - * @see org.apache.maven.reporting.AbstractMavenReport#getProject() - */ - protected MavenProject getProject() { - return project; - } - - /** - * @see org.apache.maven.reporting.AbstractMavenReport#getSiteRenderer() - */ - protected Renderer getSiteRenderer() { - return siteRenderer; - } - /** * Returns <code>true</code> if the current project is located at the Execution Root Directory (where mvn was * launched). @@ -219,14 +61,6 @@ public abstract class AbstractChangesReport extends AbstractMavenReport { * @return <code>true</code> if the current project is at the Execution Root */ protected boolean isThisTheExecutionRoot() { - getLog().debug("Root Folder:" + mavenSession.getExecutionRootDirectory()); - getLog().debug("Current Folder:" + basedir); - boolean result = mavenSession.getExecutionRootDirectory().equalsIgnoreCase(basedir); - if (result) { - getLog().debug("This is the execution root."); - } else { - getLog().debug("This is NOT the execution root."); - } - return result; + return getProject().isExecutionRoot(); } } diff --git a/src/main/java/org/apache/maven/plugins/changes/ChangesCheckMojo.java b/src/main/java/org/apache/maven/plugins/changes/ChangesCheckMojo.java index 0ec1232..47b8622 100644 --- a/src/main/java/org/apache/maven/plugins/changes/ChangesCheckMojo.java +++ b/src/main/java/org/apache/maven/plugins/changes/ChangesCheckMojo.java @@ -23,7 +23,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Locale; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; diff --git a/src/main/java/org/apache/maven/plugins/changes/ChangesMojo.java b/src/main/java/org/apache/maven/plugins/changes/ChangesReport.java similarity index 98% rename from src/main/java/org/apache/maven/plugins/changes/ChangesMojo.java rename to src/main/java/org/apache/maven/plugins/changes/ChangesReport.java index 58307fd..35e3ccc 100644 --- a/src/main/java/org/apache/maven/plugins/changes/ChangesMojo.java +++ b/src/main/java/org/apache/maven/plugins/changes/ChangesReport.java @@ -35,7 +35,6 @@ import java.util.ResourceBundle; import org.apache.commons.collections.map.CaseInsensitiveMap; import org.apache.commons.io.input.XmlStreamReader; -import org.apache.maven.execution.MavenSession; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -54,7 +53,7 @@ import org.codehaus.plexus.util.FileUtils; * @version $Id$ */ @Mojo(name = "changes-report", threadSafe = true) -public class ChangesMojo extends AbstractChangesReport { +public class ChangesReport extends AbstractChangesReport { /** * A flag whether the report should also include changes from child modules. If set to <code>false</code>, only the * changes from current project will be written to the report. @@ -168,12 +167,6 @@ public class ChangesMojo extends AbstractChangesReport { @Parameter(defaultValue = "en") private String publishDateLocale; - /** - * @since 2.2 - */ - @Parameter(defaultValue = "${session}", readonly = true, required = true) - protected MavenSession session; - /** * @since 2.4 */ @@ -223,6 +216,7 @@ public class ChangesMojo extends AbstractChangesReport { /* Public methods */ /* --------------------------------------------------------------------- */ + @Override public boolean canGenerateReport() { // Run only at the execution root if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) { @@ -232,6 +226,7 @@ public class ChangesMojo extends AbstractChangesReport { return xmlPath.isFile(); } + @Override public void executeReport(Locale locale) throws MavenReportException { failIfUsingDeprecatedParameter( escapeHTML, "escapeHTML", "Using markup inside CDATA sections does not work for all output formats!"); @@ -344,14 +339,17 @@ public class ChangesMojo extends AbstractChangesReport { } } + @Override public String getDescription(Locale locale) { return getBundle(locale).getString("report.issues.description"); } + @Override public String getName(Locale locale) { return getBundle(locale).getString("report.issues.name"); } + @Override public String getOutputName() { return "changes-report"; } @@ -397,7 +395,7 @@ public class ChangesMojo extends AbstractChangesReport { Collections.<String>emptyList(), false, encoding, - session, + mavenSession, additionalProperties); mavenFileFilter.copyFile(mavenFileFilterRequest); changesXml = resultFile; diff --git a/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java b/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java index a1ff1df..e92e84d 100644 --- a/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java +++ b/src/main/java/org/apache/maven/plugins/changes/ChangesReportGenerator.java @@ -25,11 +25,11 @@ import java.util.List; import java.util.Map; import java.util.ResourceBundle; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.sink.SinkEventAttributes; import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet; -import org.apache.maven.doxia.util.HtmlTools; +import org.apache.maven.doxia.util.DoxiaUtils; import org.apache.maven.plugins.changes.model.Action; import org.apache.maven.plugins.changes.model.Component; import org.apache.maven.plugins.changes.model.DueTo; @@ -384,6 +384,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { sink.sectionTitle2_(); sink.table(); + sink.tableRows(); sink.tableRow(); @@ -398,7 +399,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { for (Release release : releaseList) { sink.tableRow(); - sinkCellLink(sink, release.getVersion(), "#" + HtmlTools.encodeId(release.getVersion())); + sinkCellLink(sink, release.getVersion(), "#" + DoxiaUtils.encodeId(release.getVersion())); sinkCell(sink, release.getDateRelease()); @@ -407,6 +408,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { sink.tableRow_(); } + sink.tableRows_(); sink.table_(); // MCHANGES-46 @@ -449,7 +451,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { final String date = (release.getDateRelease() == null) ? "" : " \u2013 " + release.getDateRelease(); SinkEventAttributes attrs = new SinkEventAttributeSet(); - attrs.addAttribute(SinkEventAttributes.ID, HtmlTools.encodeId(release.getVersion())); + attrs.addAttribute(SinkEventAttributes.ID, DoxiaUtils.encodeId(release.getVersion())); sink.sectionTitle(Sink.SECTION_LEVEL_2, attrs); sink.text(bundle.getString("report.changes.label.release") + " " + release.getVersion() + date); sink.sectionTitle_(Sink.SECTION_LEVEL_2); @@ -460,6 +462,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { sink.paragraph_(); } else { sink.table(); + sink.tableRows(); sink.tableRow(); sinkHeader(sink, bundle.getString("report.issues.label.type")); @@ -479,6 +482,7 @@ public class ChangesReportGenerator extends AbstractIssuesReportGenerator { constructComponent(sink, bundle, component); } + sink.tableRows_(); sink.table_(); } diff --git a/src/main/java/org/apache/maven/plugins/changes/FeedGenerator.java b/src/main/java/org/apache/maven/plugins/changes/FeedGenerator.java index 23cba0b..3e9aaba 100644 --- a/src/main/java/org/apache/maven/plugins/changes/FeedGenerator.java +++ b/src/main/java/org/apache/maven/plugins/changes/FeedGenerator.java @@ -36,7 +36,7 @@ import com.sun.syndication.feed.synd.SyndFeed; import com.sun.syndication.feed.synd.SyndFeedImpl; import com.sun.syndication.io.FeedException; import com.sun.syndication.io.SyndFeedOutput; -import org.apache.maven.doxia.util.HtmlTools; +import org.apache.maven.doxia.util.DoxiaUtils; import org.apache.maven.plugins.changes.model.Release; /** @@ -197,7 +197,7 @@ public class FeedGenerator { final SyndEntry entry = new SyndEntryImpl(); entry.setTitle(release.getVersion()); - entry.setLink(link + "#" + HtmlTools.encodeId(release.getVersion())); + entry.setLink(link + "#" + DoxiaUtils.encodeId(release.getVersion())); entry.setDescription(getSyndContent(release)); entry.setPublishedDate(getDate(release.getDateRelease(), dateFormat)); diff --git a/src/main/java/org/apache/maven/plugins/github/GitHubMojo.java b/src/main/java/org/apache/maven/plugins/github/GitHubReport.java similarity index 98% rename from src/main/java/org/apache/maven/plugins/github/GitHubMojo.java rename to src/main/java/org/apache/maven/plugins/github/GitHubReport.java index 6093766..0e390a3 100644 --- a/src/main/java/org/apache/maven/plugins/github/GitHubMojo.java +++ b/src/main/java/org/apache/maven/plugins/github/GitHubReport.java @@ -45,7 +45,7 @@ import org.apache.maven.settings.crypto.SettingsDecrypter; * @since 2.8 */ @Mojo(name = "github-report", threadSafe = true) -public class GitHubMojo extends AbstractChangesReport { +public class GitHubReport extends AbstractChangesReport { /** * Valid Github columns. @@ -125,14 +125,17 @@ public class GitHubMojo extends AbstractChangesReport { @Parameter(defaultValue = "false") private boolean onlyCurrentVersion; + @Override public String getOutputName() { return "github-report"; } + @Override public String getName(Locale locale) { return getBundle(locale).getString("report.issues.name"); } + @Override public String getDescription(Locale locale) { return getBundle(locale).getString("report.issues.description"); } @@ -144,6 +147,7 @@ public class GitHubMojo extends AbstractChangesReport { /** * @see org.apache.maven.reporting.AbstractMavenReport#canGenerateReport() */ + @Override public boolean canGenerateReport() { // Run only at the execution root if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) { diff --git a/src/main/java/org/apache/maven/plugins/issues/IssuesReportGenerator.java b/src/main/java/org/apache/maven/plugins/issues/IssuesReportGenerator.java index ed1ea32..8a1abb6 100644 --- a/src/main/java/org/apache/maven/plugins/issues/IssuesReportGenerator.java +++ b/src/main/java/org/apache/maven/plugins/issues/IssuesReportGenerator.java @@ -82,6 +82,7 @@ public class IssuesReportGenerator extends AbstractIssuesReportGenerator { } sink.table(); + sink.tableRows(); sink.tableRow(); @@ -245,7 +246,7 @@ public class IssuesReportGenerator extends AbstractIssuesReportGenerator { sink.tableRow_(); } - + sink.tableRows_(); sink.table_(); } } diff --git a/src/main/java/org/apache/maven/plugins/jira/AbstractJiraDownloader.java b/src/main/java/org/apache/maven/plugins/jira/AbstractJiraDownloader.java index 020b0c1..2132935 100644 --- a/src/main/java/org/apache/maven/plugins/jira/AbstractJiraDownloader.java +++ b/src/main/java/org/apache/maven/plugins/jira/AbstractJiraDownloader.java @@ -19,8 +19,6 @@ package org.apache.maven.plugins.jira; import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; import java.util.List; import org.apache.maven.plugin.MojoExecutionException; @@ -30,8 +28,6 @@ import org.apache.maven.plugins.issues.IssueUtils; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Settings; -import org.apache.maven.wagon.proxy.ProxyInfo; -import org.apache.maven.wagon.proxy.ProxyUtils; /** * Abstract API, more or less, to retrieving issue information from JIRA. Intended to have subclasses for the old (RSS) @@ -153,26 +149,7 @@ public abstract class AbstractJiraDownloader { } if (proxy != null) { - - ProxyInfo proxyInfo = new ProxyInfo(); - proxyInfo.setNonProxyHosts(proxy.getNonProxyHosts()); - - // Get the host out of the JIRA URL - URL url = null; - try { - url = new URL(jiraUrl); - } catch (MalformedURLException e) { - getLog().error("Invalid JIRA URL: " + jiraUrl + ". " + e.getMessage()); - } - String jiraHost = null; - if (url != null) { - jiraHost = url.getHost(); - } - - if (ProxyUtils.validateNonProxyHosts(proxyInfo, jiraHost)) { - return; - } - + /// TODO check proxy.getNonProxyHosts() proxyHost = settings.getActiveProxy().getHost(); proxyPort = settings.getActiveProxy().getPort(); proxyUser = settings.getActiveProxy().getUsername(); diff --git a/src/main/java/org/apache/maven/plugins/jira/JiraMojo.java b/src/main/java/org/apache/maven/plugins/jira/JiraReport.java similarity index 99% rename from src/main/java/org/apache/maven/plugins/jira/JiraMojo.java rename to src/main/java/org/apache/maven/plugins/jira/JiraReport.java index 03ea4c0..18f77ab 100644 --- a/src/main/java/org/apache/maven/plugins/jira/JiraMojo.java +++ b/src/main/java/org/apache/maven/plugins/jira/JiraReport.java @@ -25,7 +25,7 @@ import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.changes.AbstractChangesReport; @@ -45,7 +45,7 @@ import org.apache.maven.settings.Settings; * @version $Id$ */ @Mojo(name = "jira-report", threadSafe = true) -public class JiraMojo extends AbstractChangesReport { +public class JiraReport extends AbstractChangesReport { /** * Valid JIRA columns. */ @@ -297,6 +297,7 @@ public class JiraMojo extends AbstractChangesReport { /** * @see org.apache.maven.reporting.AbstractMavenReport#canGenerateReport() */ + @Override public boolean canGenerateReport() { // Run only at the execution root if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) { @@ -316,6 +317,7 @@ public class JiraMojo extends AbstractChangesReport { return message == null; } + @Override public void executeReport(Locale locale) throws MavenReportException { // Validate parameters List<Integer> columnIds = IssuesReportHelper.getColumnIds(columnNames, JIRA_COLUMNS); @@ -366,14 +368,17 @@ public class JiraMojo extends AbstractChangesReport { } } + @Override public String getDescription(Locale locale) { return getBundle(locale).getString("report.issues.description"); } + @Override public String getName(Locale locale) { return getBundle(locale).getString("report.issues.name"); } + @Override public String getOutputName() { return "jira-report"; } diff --git a/src/main/java/org/apache/maven/plugins/resource/loader/ProjectResourceLoader.java b/src/main/java/org/apache/maven/plugins/resource/loader/ProjectResourceLoader.java deleted file mode 100644 index bfd3b76..0000000 --- a/src/main/java/org/apache/maven/plugins/resource/loader/ProjectResourceLoader.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugins.resource.loader; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; - -import org.apache.commons.collections.ExtendedProperties; -import org.apache.velocity.exception.ResourceNotFoundException; -import org.apache.velocity.runtime.resource.Resource; -import org.apache.velocity.runtime.resource.loader.ResourceLoader; -import org.apache.velocity.util.StringUtils; - -/** - * Resource Loader for external projects. - * - * @version $Id$ - */ -public class ProjectResourceLoader extends ResourceLoader { - /** - * The paths to search for templates. - */ - private List<String> paths = null; - - /** - * Used to map the path that a template was found on so that we can properly check the modification times of the - * files. - */ - private Hashtable<String, String> templatePaths = new Hashtable<>(); - - public void init(ExtendedProperties configuration) { - rsvc.getLog().info("ProjectResourceLoader : initialization starting."); - - String separator = System.getProperty("file.separator"); - - String path = System.getProperty("user.dir") + separator + "src" + separator + "main" + separator + "resources" - + separator; - - rsvc.getLog().info("path :" + path); - - paths = new ArrayList<>(); - - paths.add(path); - - for (String path1 : paths) { - rsvc.getLog().info("ProjectResourceLoader : adding path '" + path1 + "'"); - } - rsvc.getLog().info("ProjectResourceLoader : initialization complete."); - } - - /** - * Get an InputStream so that the Runtime can build a template with it. - * - * @param templateName name of template to get - * @return InputStream containing the template - * @throws ResourceNotFoundException if template not found in the file template path. - */ - public synchronized InputStream getResourceStream(String templateName) throws ResourceNotFoundException { - /* - * Make sure we have a valid templateName. - */ - if (templateName == null || templateName.length() == 0) { - /* - * If we don't get a properly formed templateName then there's not much we can do. So we'll forget about - * trying to search any more paths for the template. - */ - throw new ResourceNotFoundException("Need to specify a file name or file path!"); - } - - String template = StringUtils.normalizePath(templateName); - if (template == null || template.length() == 0) { - String msg = "Project Resource loader error : argument " + template - + " contains .. and may be trying to access " + "content outside of template root. Rejected."; - - rsvc.getLog().error("ProjectResourceLoader : " + msg); - - throw new ResourceNotFoundException(msg); - } - - /* - * if a / leads off, then just nip that :) - */ - if (template.startsWith("/")) { - template = template.substring(1); - } - - // MCHANGES-118 adding the basedir path - paths.add((String) rsvc.getApplicationAttribute("baseDirectory")); - - for (String path : paths) { - InputStream inputStream = findTemplate(path, template); - - if (inputStream != null) { - /* - * Store the path that this template came from so that we can check its modification time. - */ - - templatePaths.put(templateName, path); - return inputStream; - } - } - - /* - * We have now searched all the paths for templates and we didn't find anything so throw an exception. - */ - String msg = "ProjectResourceLoader Error: cannot find resource " + template; - - throw new ResourceNotFoundException(msg); - } - - /** - * Try to find a template given a normalized path. - * - * @param path a normalized path - * @return InputStream input stream that will be parsed - */ - private InputStream findTemplate(String path, String template) { - try { - File file = new File(path, template); - - if (file.canRead()) { - return new BufferedInputStream(new FileInputStream(file.getAbsolutePath())); - } else { - return null; - } - } catch (FileNotFoundException fnfe) { - /* - * log and convert to a general Velocity ResourceNotFoundException - */ - return null; - } - } - - /** - * How to keep track of all the modified times across the paths. Note that a file might have appeared in a directory - * which is earlier in the path; so we should search the path and see if the file we find that way is the same as - * the one that we have cached. - */ - public boolean isSourceModified(Resource resource) { - /* - * we assume that the file needs to be reloaded; if we find the original file and it's unchanged, then we'll - * flip this. - */ - boolean modified = true; - - String fileName = resource.getName(); - String path = templatePaths.get(fileName); - File currentFile = null; - - for (int i = 0; currentFile == null && i < paths.size(); i++) { - String testPath = paths.get(i); - File testFile = new File(testPath, fileName); - if (testFile.canRead()) { - currentFile = testFile; - } - } - File file = new File(path, fileName); - if (currentFile == null || !file.exists()) { - /* - * noop: if the file is missing now (either the cached file is gone, or the file can no longer be found) - * then we leave modified alone (it's set to true); a reload attempt will be done, which will either use a - * new template or fail with an appropriate message about how the file couldn't be found. - */ - } else if (currentFile.equals(file) && file.canRead()) { - /* - * if only if currentFile is the same as file and file.lastModified() is the same as - * resource.getLastModified(), then we should use the cached version. - */ - modified = (file.lastModified() != resource.getLastModified()); - } - - /* - * rsvc.debug("isSourceModified for " + fileName + ": " + modified); - */ - return modified; - } - - public long getLastModified(Resource resource) { - String path = templatePaths.get(resource.getName()); - File file = new File(path, resource.getName()); - - if (file.canRead()) { - return file.lastModified(); - } else { - return 0; - } - } -} diff --git a/src/main/java/org/apache/maven/plugins/trac/TracMojo.java b/src/main/java/org/apache/maven/plugins/trac/TracReport.java similarity index 98% rename from src/main/java/org/apache/maven/plugins/trac/TracMojo.java rename to src/main/java/org/apache/maven/plugins/trac/TracReport.java index 7c2b148..87a8101 100644 --- a/src/main/java/org/apache/maven/plugins/trac/TracMojo.java +++ b/src/main/java/org/apache/maven/plugins/trac/TracReport.java @@ -43,7 +43,7 @@ import org.apache.xmlrpc.XmlRpcException; * @since 2.1 */ @Mojo(name = "trac-report", threadSafe = true) -public class TracMojo extends AbstractChangesReport { +public class TracReport extends AbstractChangesReport { /** * Deprecated Trac columns. */ @@ -121,6 +121,7 @@ public class TracMojo extends AbstractChangesReport { /** * @see org.apache.maven.reporting.AbstractMavenReport#canGenerateReport() */ + @Override public boolean canGenerateReport() { // Run only at the execution root if (runOnlyAtExecutionRoot && !isThisTheExecutionRoot()) { @@ -134,6 +135,7 @@ public class TracMojo extends AbstractChangesReport { return message == null; } + @Override public void executeReport(Locale locale) throws MavenReportException { // Validate parameters List<Integer> columnIds = @@ -171,14 +173,17 @@ public class TracMojo extends AbstractChangesReport { } } + @Override public String getDescription(Locale locale) { return getBundle(locale).getString("report.issues.description"); } + @Override public String getName(Locale locale) { return getBundle(locale).getString("report.issues.name"); } + @Override public String getOutputName() { return "trac-report"; } diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml deleted file mode 100644 index 3c7408c..0000000 --- a/src/main/resources/META-INF/plexus/components.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!-- -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. ---> -<component-set> - <components> - <component> - <role>org.codehaus.plexus.velocity.VelocityComponent</role> - <role-hint>maven-changes-plugin</role-hint> - <implementation>org.codehaus.plexus.velocity.DefaultVelocityComponent</implementation> - <configuration> - <properties> - <property> - <name>resource.loader</name> - <value>file,class</value> - </property> - <property> - <name>class.resource.loader.class</name> - <value>org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</value> - </property> - <property> - <name>file.resource.loader.class</name> - <value>org.apache.maven.plugins.resource.loader.ProjectResourceLoader</value> - </property> - </properties> - </configuration> - </component> - </components> -</component-set> \ No newline at end of file diff --git a/src/site/site.xml b/src/site/site.xml index e624258..4119803 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -22,6 +22,13 @@ under the License. <project xmlns="http://maven.apache.org/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd"> + + <skin> + <groupId>org.apache.maven.skins</groupId> + <artifactId>maven-fluido-skin</artifactId> + <version>${version.maven-fluido-skin}</version> + </skin> + <body> <menu name="Overview"> <item name="Introduction" href="index.html"/> diff --git a/src/test/java/org/apache/maven/plugins/announcement/AnnouncementMojoTest.java b/src/test/java/org/apache/maven/plugins/announcement/AnnouncementMojoTest.java index 52ace02..32e6920 100644 --- a/src/test/java/org/apache/maven/plugins/announcement/AnnouncementMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/announcement/AnnouncementMojoTest.java @@ -48,7 +48,7 @@ public class AnnouncementMojoTest extends AbstractMojoTestCase { setVariableValueToObject(mojo, "version", "1.1"); setVariableValueToObject(mojo, "template", "announcement.vm"); setVariableValueToObject( - mojo, "templateDirectory", "/src/main/resources/org/apache/maven/plugins/announcement/"); + mojo, "templateDirectory", "src/main/resources/org/apache/maven/plugins/announcement/"); setVariableValueToObject(mojo, "basedir", getBasedir()); setVariableValueToObject(mojo, "introduction", "Nice library"); mojo.execute(); diff --git a/src/test/java/org/apache/maven/plugins/jira/JiraMojoTest.java b/src/test/java/org/apache/maven/plugins/jira/JiraReportTest.java similarity index 89% rename from src/test/java/org/apache/maven/plugins/jira/JiraMojoTest.java rename to src/test/java/org/apache/maven/plugins/jira/JiraReportTest.java index 869949b..a27babf 100644 --- a/src/test/java/org/apache/maven/plugins/jira/JiraMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/jira/JiraReportTest.java @@ -21,13 +21,13 @@ package org.apache.maven.plugins.jira; import org.apache.maven.plugin.testing.AbstractMojoTestCase; /** - * Unit tests for {@link JiraMojo}. + * Unit tests for {@link JiraReport}. * * @author jrh3k5 * @since 2.8 */ -public class JiraMojoTest extends AbstractMojoTestCase { - private final JiraMojo mojo = new JiraMojo(); +public class JiraReportTest extends AbstractMojoTestCase { + private final JiraReport mojo = new JiraReport(); /** * If the mojo has been marked to be skipped, then it should indicate that the report cannot be generated. diff --git a/src/test/java/org/apache/maven/plugins/jira/JiraUnicodeTestCase.java b/src/test/java/org/apache/maven/plugins/jira/JiraUnicodeTestCase.java index dc25af6..b429704 100644 --- a/src/test/java/org/apache/maven/plugins/jira/JiraUnicodeTestCase.java +++ b/src/test/java/org/apache/maven/plugins/jira/JiraUnicodeTestCase.java @@ -20,14 +20,20 @@ package org.apache.maven.plugins.jira; import java.io.File; import java.io.InputStream; +import java.util.Collections; +import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Plugin; +import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.project.MavenProject; -import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager; -import org.sonatype.aether.util.DefaultRepositorySystemSession; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.RepositorySystem; +import org.eclipse.aether.repository.LocalRepository; +import org.eclipse.aether.repository.RemoteRepository; import static java.nio.charset.StandardCharsets.UTF_8; @@ -47,13 +53,33 @@ public class JiraUnicodeTestCase extends AbstractMojoTestCase { assertNotNull(pom); assertTrue(pom.exists()); - JiraMojo mojo = (JiraMojo) lookupMojo("jira-report", pom); + JiraReport mojo = (JiraReport) lookupMojo("jira-report", pom); MavenProject project = new JiraUnicodeTestProjectStub(); MavenSession session = newMavenSession(project); - DefaultRepositorySystemSession repoSession = (DefaultRepositorySystemSession) session.getRepositorySession(); - repoSession.setLocalRepositoryManager(new SimpleLocalRepositoryManager("target/local-repo")); + + RepositorySystem repositorySystem = lookup(RepositorySystem.class); + + DefaultRepositorySystemSession repositorySystemSession = + (DefaultRepositorySystemSession) session.getRepositorySession(); + repositorySystemSession.setLocalRepositoryManager(repositorySystem.newLocalRepositoryManager( + repositorySystemSession, new LocalRepository(System.getProperty("localRepository")))); + + // Test need to download a maven-fluido-skin if not present in local repo + List<RemoteRepository> remoteRepositories = repositorySystem.newResolutionRepositories( + repositorySystemSession, + Collections.singletonList( + new RemoteRepository.Builder("central", "default", "https://repo.maven.apache.org/maven2") + .build())); + setVariableValueToObject(mojo, "project", project); + setVariableValueToObject(mojo, "reactorProjects", Collections.singletonList(project)); + setVariableValueToObject(mojo, "repoSession", repositorySystemSession); + setVariableValueToObject(mojo, "remoteProjectRepositories", remoteRepositories); + + setVariableValueToObject(mojo, "siteDirectory", new File("non-existing")); setVariableValueToObject(mojo, "mavenSession", session); + setVariableValueToObject(mojo, "mojoExecution", new MojoExecution(new Plugin(), "jira-report", "default")); + String jiraXml; try (InputStream testJiraXmlStream = JiraUnicodeTestCase.class.getResourceAsStream("unicode-jira-results.xml")) {