From 257615a311a4e21eb99a39c1c914aca0328e6f00 Mon Sep 17 00:00:00 2001 From: Mirko Friedenhagen Date: Thu, 30 May 2013 21:14:10 +0200 Subject: [PATCH] Convert all doclet annotations to new Java annotations, tests of maven-surefire-report-plugin are running successfully. --- maven-surefire-report-plugin/pom.xml | 22 ++++++++++++++- .../report/AbstractSurefireReportMojo.java | 27 +++++++++---------- .../surefire/report/FailsafeReportMojo.java | 13 ++++----- .../surefire/report/SurefireReportMojo.java | 15 ++++++----- .../report/SurefireReportOnlyMojo.java | 9 ++++--- 5 files changed, 56 insertions(+), 30 deletions(-) diff --git a/maven-surefire-report-plugin/pom.xml b/maven-surefire-report-plugin/pom.xml index 918690e844..49eabce158 100644 --- a/maven-surefire-report-plugin/pom.xml +++ b/maven-surefire-report-plugin/pom.xml @@ -64,6 +64,16 @@ org.apache.maven maven-plugin-api + + org.apache.maven.plugin-tools + maven-plugin-annotations + + + org.apache.maven + maven-artifact + + + org.apache.maven.surefire @@ -127,8 +137,18 @@ org.apache.maven.plugins maven-plugin-plugin - 2.8 + 3.2 + + surefire-report + true + + + mojo-descriptor + + descriptor + + generated-helpmojo diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java index 90cfc31402..25d3468be2 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java @@ -28,6 +28,8 @@ import java.util.ResourceBundle; import org.apache.maven.doxia.siterenderer.Renderer; import org.apache.maven.model.ReportPlugin; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.AbstractMavenReport; import org.apache.maven.reporting.MavenReportException; @@ -45,85 +47,82 @@ public abstract class AbstractSurefireReportMojo /** * Location where generated html will be created. * - * @parameter expression="${project.reporting.outputDirectory}" * @noinspection UnusedDeclaration */ + @Parameter(property = "project.reporting.outputDirectory") private File outputDirectory; /** * Doxia Site Renderer * - * @component * @noinspection UnusedDeclaration */ + @Component private Renderer siteRenderer; /** * Maven Project * - * @parameter expression="${project}" - * @required @readonly * @noinspection UnusedDeclaration */ + @Parameter(property = "project", required = true, readonly = true) private MavenProject project; /** * If set to false, only failures are shown. * - * @parameter expression="${showSuccess}" default-value="true" - * @required * @noinspection UnusedDeclaration */ + @Parameter(defaultValue = "true", required = true, property = "showSuccess") private boolean showSuccess; /** * Directories containing the XML Report files that will be parsed and rendered to HTML format. * - * @parameter * @noinspection UnusedDeclaration */ + @Parameter private File[] reportsDirectories; /** * (Deprecated, use reportsDirectories) This directory contains the XML Report files that will be parsed and rendered to HTML format. * - * @parameter * @noinspection UnusedDeclaration - * @deprecated */ + @Deprecated + @Parameter private File reportsDirectory; /** * The projects in the reactor for aggregation report. * - * @parameter expression="${reactorProjects}" - * @readonly * @noinspection MismatchedQueryAndUpdateOfCollection, UnusedDeclaration */ + @Parameter(property = "reactorProjects", readonly = true) private List reactorProjects; /** * Location of the Xrefs to link. * - * @parameter default-value="${project.reporting.outputDirectory}/xref-test" * @noinspection UnusedDeclaration */ + @Parameter(defaultValue = "${project.reporting.outputDirectory}/xref-test") private File xrefLocation; /** * Whether to link the XRef if found. * - * @parameter expression="${linkXRef}" default-value="true" * @noinspection UnusedDeclaration */ + @Parameter(defaultValue = "true", property = "linkXRef") private boolean linkXRef; /** * Whether to build an aggregated report at the root, or build individual reports. * - * @parameter expression="${aggregate}" default-value="false" * @noinspection UnusedDeclaration */ + @Parameter(defaultValue = "false", property = "aggregate") private boolean aggregate; /** diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java index c2237de8b1..81e08e187c 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java @@ -22,6 +22,9 @@ import java.io.File; import java.util.Locale; import java.util.ResourceBundle; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; @@ -31,10 +34,9 @@ * See http://jira.codehaus.org/browse/SUREFIRE-257 * * @author Stephen Connolly - * @goal failsafe-report-only - * @execute phase="validate" lifecycle="surefire" * @since 2.10 */ +@Mojo(name = "failsafe-report-only") public class FailsafeReportMojo extends AbstractSurefireReportMojo { @@ -42,29 +44,28 @@ public class FailsafeReportMojo /** * The filename to use for the report. * - * @parameter expression="${outputName}" default-value="failsafe-report" - * @required * @noinspection UnusedDeclaration */ + @Parameter(defaultValue = "failsafe-report", property = "outputName", required = true) private String outputName; /** * If set to true the failsafe report will be generated even when there are no failsafe result files. * Defaults to false to preserve legacy behaviour pre 2.10 * - * @parameter expression="${alwaysGenerateFailsafeReport}" default-value="false" * @noinspection UnusedDeclaration * @since 2.11 */ + @Parameter(defaultValue = "false", property = "alwaysGenerateFailsafeReport") private boolean alwaysGenerateFailsafeReport; /** * If set to true the failsafe report generation will be skipped. * - * @parameter expression="${skipFailsafeReport}" default-value="false" * @noinspection UnusedDeclaration * @since 2.11 */ + @Parameter(defaultValue = "false", property = "skipFailsafeReport") private boolean skipFailsafeReport; protected File getSurefireReportsDirectory( MavenProject subProject ) diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java index d09ca971e1..966e99b75c 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java @@ -20,6 +20,10 @@ */ import java.io.File; +import org.apache.maven.plugins.annotations.Execute; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; @@ -27,9 +31,9 @@ * Creates a nicely formatted Surefire Test Report in html format. * * @author Johnny R. Ruiz III - * @goal report - * @execute phase="test" lifecycle="surefire" */ +@Mojo(name = "report", inheritByDefault = false) +@Execute(lifecycle = "surefire", phase = LifecyclePhase.TEST) public class SurefireReportMojo extends AbstractSurefireReportMojo { @@ -37,29 +41,28 @@ public class SurefireReportMojo /** * The filename to use for the report. * - * @parameter expression="${outputName}" default-value="surefire-report" - * @required * @noinspection UnusedDeclaration */ + @Parameter(defaultValue = "surefire-report", property = "outputName", required = true) private String outputName; /** * If set to true the surefire report will be generated even when there are no surefire result files. * Defaulyts to true to preserve legacy behaviour pre 2.10. * - * @parameter expression="${alwaysGenerateSurefireReport}" default-value="true" * @noinspection UnusedDeclaration * @since 2.11 */ + @Parameter(defaultValue = "true", property = "alwaysGenerateSurefireReport") private boolean alwaysGenerateSurefireReport; /** * If set to true the surefire report generation will be skipped. * - * @parameter expression="${skipSurefireReport}" default-value="false" * @noinspection UnusedDeclaration * @since 2.11 */ + @Parameter(defaultValue = "false", property = "skipSurefireReport") private boolean skipSurefireReport; protected File getSurefireReportsDirectory( MavenProject subProject ) diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java index a4208b473a..0b1fc59a39 100644 --- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java +++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportOnlyMojo.java @@ -19,6 +19,10 @@ * under the License. */ +import org.apache.maven.plugins.annotations.Execute; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; + /** * Creates a nicely formatted Surefire Test Report in html format. * This goal does not run the tests, it only builds the reports. @@ -26,12 +30,11 @@ * http://jira.codehaus.org/browse/SUREFIRE-257 * * @author Barrie Treloar - * @goal report-only - * @execute phase="validate" lifecycle="surefire" * @since 2.3 */ +@Mojo(name = "report-only") +@Execute(phase = LifecyclePhase.NONE) public class SurefireReportOnlyMojo extends SurefireReportMojo { - }