This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit dbff9591ade58e05a478aac87db803d9850e9837 Author: Robert Munteanu <[email protected]> AuthorDate: Wed Oct 7 07:58:15 2015 +0000 SLING-5107 - Switch to Java annotations for Maven plugins Switch to Java annotations for the maven-launchpad-plugin git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1707200 13f79535-47bb-0310-9956-ffa450edef68 --- pom.xml | 29 ++++++-- .../projectsupport/AbstractBundleListMojo.java | 86 +++++----------------- .../AbstractLaunchpadFrameworkMojo.java | 10 +-- .../AbstractLaunchpadStartingMojo.java | 18 ++--- .../AbstractUsingBundleListMojo.java | 43 ++++------- .../maven/projectsupport/AttachBundleListMojo.java | 23 +++--- .../AttachPartialBundleListMojo.java | 21 +++--- .../CheckBundleListForSnapshotsMojo.java | 11 ++- .../maven/projectsupport/CreateBundleJarMojo.java | 25 +++---- .../CreateKarafFeatureDescriptorMojo.java | 28 +++---- .../CreatePaxRunnerBundleProvisionFileMojo.java | 13 ++-- .../projectsupport/DisplayBundleUpdatesMojo.java | 61 +++++---------- .../maven/projectsupport/OutputBundleListMojo.java | 7 +- .../maven/projectsupport/PreparePackageMojo.java | 38 ++++------ .../projectsupport/PrepareTestWebAppMojo.java | 24 +++--- .../apache/sling/maven/projectsupport/RunMojo.java | 7 +- .../sling/maven/projectsupport/StartMojo.java | 16 ++-- .../sling/maven/projectsupport/StatusMojo.java | 15 ++-- .../sling/maven/projectsupport/StopMojo.java | 15 ++-- 19 files changed, 182 insertions(+), 308 deletions(-) diff --git a/pom.xml b/pom.xml index f0eafe7..a12e40f 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,23 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <executions> + <execution> + <id>default-descriptor</id> + <phase>process-classes</phase> + </execution> + <execution> + <id>help-goal</id> + <goals> + <goal>helpmojo</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> <groupId>org.codehaus.modello</groupId> <artifactId>modello-maven-plugin</artifactId> <version>1.8.1</version> @@ -96,11 +113,6 @@ <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-plugin-plugin</artifactId> - <version>2.5.1</version> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <!-- No javadocs --> @@ -227,5 +239,12 @@ <version>1.9.5</version> <scope>test</scope> </dependency> + + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>3.4</version> + <scope>provided</scope> + </dependency> </dependencies> </project> diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java index a2f5566..17e548c 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java @@ -35,6 +35,8 @@ import org.apache.maven.artifact.versioning.VersionRange; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; 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.MavenProject; import org.apache.maven.project.MavenProjectHelper; import org.codehaus.plexus.util.SelectorUtils; @@ -47,117 +49,67 @@ public abstract class AbstractBundleListMojo extends AbstractMojo { */ protected static final String PARTIAL = "partialbundlelist"; - /** - * @parameter default-value="${basedir}/src/main/bundles/list.xml" - */ + @Parameter(defaultValue = "${basedir}/src/main/bundles/list.xml") protected File bundleListFile; /** * The Maven project. - * - * @parameter expression="${project}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project}", readonly = true) protected MavenProject project; - /** - * @component - */ + @Component protected MavenProjectHelper projectHelper; - /** - * @parameter expression="${configDirectory}" - * default-value="src/main/config" - */ + @Parameter(property = "configDirectory", defaultValue = "src/main/config") private File configDirectory; - /** - * @parameter expression="${commonSlingProps}" - * default-value="src/main/sling/common.properties" - */ + @Parameter(property = "commonSlingProps", defaultValue = "src/main/sling/common.properties") protected File commonSlingProps; - /** - * @parameter expression="${commonSlingBootstrap}" - * default-value="src/main/sling/common.bootstrap.txt" - */ + @Parameter(property = "commonSlingBootstrap", defaultValue = "src/main/sling/common.bootstrap.txt") protected File commonSlingBootstrap; - /** - * @parameter expression="${webappSlingProps}" - * default-value="src/main/sling/webapp.properties" - */ + @Parameter(property = "webappSlingProps", defaultValue = "src/main/sling/webapp.properties") protected File webappSlingProps; - /** - * @parameter expression="${webappSlingBootstrap}" - * default-value="src/main/sling/webapp.bootstrap.txt" - */ + @Parameter(property = "webappSlingBootstrap", defaultValue = "src/main/sling/webapp.bootstrap.txt") protected File webappSlingBootstrap; - /** - * @parameter expression="${standaloneSlingProps}" - * default-value="src/main/sling/standalone.properties" - */ + @Parameter(property = "standaloneSlingProps", defaultValue = "src/main/sling/standalone.properties") protected File standaloneSlingProps; - /** - * @parameter expression="${standaloneSlingBootstrap}" - * default-value="src/main/sling/standalone.bootstrap.txt" - */ + @Parameter(property = "standaloneSlingBootstrap", defaultValue = "src/main/sling/standalone.bootstrap.txt") protected File standaloneSlingBootstrap; - /** - * @parameter expression="${ignoreBundleListConfig}" - * default-value="false" - */ + @Parameter(property="ignoreBundleListConfig", defaultValue = "false") protected boolean ignoreBundleListConfig; - /** - * @parameter expression="${session} - * @required - * @readonly - */ + @Parameter(defaultValue = "${session}", readonly = true) protected MavenSession mavenSession; /** * Used to look up Artifacts in the remote repository. - * - * @component */ + @Component private ArtifactFactory factory; /** * Used to look up Artifacts in the remote repository. - * - * @component hint="maven" */ + @Component(hint = "maven") private ArtifactMetadataSource metadataSource; /** * Location of the local repository. - * - * @parameter expression="${localRepository}" - * @readonly - * @required */ + @Parameter( defaultValue = "${localRepository}", readonly = true, required = true) private ArtifactRepository local; - /** - * List of Remote Repositories used by the resolver. - * - * @parameter expression="${project.remoteArtifactRepositories}" - * @readonly - * @required - */ + @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true, required = true) private List<ArtifactRepository> remoteRepos; - /** - * Used to look up Artifacts in the remote repository. - * - * @component - */ + @Component private ArtifactResolver resolver; protected File getConfigDirectory() { diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java index 23d16d0..551b665 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java @@ -23,6 +23,7 @@ import java.util.TreeSet; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel; @@ -37,23 +38,20 @@ public abstract class AbstractLaunchpadFrameworkMojo extends AbstractUsingBundle /** * The name of the directory within the output directory into which the base * JAR should be installed. - * - * @parameter default-value="resources" */ + @Parameter(defaultValue = "resources") protected String baseDestination; /** * The directory which contains the start-level bundle directories. - * - * @parameter default-value="bundles" */ + @Parameter(defaultValue = "bundles") private String bundlesDirectory; /** * The directory which contains the bootstrap bundle directories. - * - * @parameter */ + @Parameter private String bootDirectory; protected String getPathForArtifact(final int startLevel, final String artifactName, final String runModes) { diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java index 636a470..9c64df0 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java @@ -29,6 +29,7 @@ import org.apache.felix.framework.Logger; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.shared.filtering.MavenFilteringException; import org.apache.maven.shared.filtering.PropertyUtils; import org.apache.sling.launchpad.api.LaunchpadContentProvider; @@ -71,26 +72,17 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleL /** * The definition of the package to be included to provide web support for * JAR-packaged projects (i.e. pax-web). - * - * @parameter */ + @Parameter private ArtifactDefinition jarWebSupport; - /** - * @parameter expression="${felix.log.level}" - */ + @Parameter(property = "felix.log.level") private String logLevel; - /** - * @parameter expression="${propertiesFile}" - * default-value="src/test/config/sling.properties" - */ + @Parameter(property = "propertiesFile", defaultValue = "src/test/config/sling.properties") private File propertiesFile; - /** - * @parameter expression="${resourceProviderRoot}" - * default-value="src/test/resources" - */ + @Parameter(property = "resourceProviderRoot", defaultValue = "src/test/resources") private File resourceProviderRoot; private LaunchpadContentProvider resourceProvider = new BundleListContentProvider(resourceProviderRoot) { diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java index 4605275..b8ded24 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java @@ -31,12 +31,15 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.shared.filtering.MavenFileFilter; import org.apache.maven.shared.filtering.MavenFilteringException; import org.apache.maven.shared.filtering.PropertyUtils; import org.apache.sling.maven.projectsupport.BundleListUtils.ArtifactDefinitionsCallback; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; import org.codehaus.plexus.archiver.ArchiverException; +import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.zip.ZipUnArchiver; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; @@ -74,73 +77,61 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo /** * The definition of the defaultBundleList artifact. - * - * @parameter */ + @Parameter protected ArtifactDefinition defaultBundleList; /** * Any additional bundles to include in the project's bundles directory. - * - * @parameter */ + @Parameter private ArtifactDefinition[] additionalBundles; private BundleList initializedBundleList; /** * Bundles which should be removed from the project's bundles directory. - * - * @parameter */ + @Parameter private ArtifactDefinition[] bundleExclusions; /** * If true, include the default bundles. - * - * @parameter expression="${includeDefaultBundles}" default-value="true" */ + @Parameter( property = "includeDefaultBundles", defaultValue = "true") private boolean includeDefaultBundles; - /** - * @parameter - */ + @Parameter private File[] rewriteRuleFiles; /** * The list of tokens to include when copying configs * from partial bundle lists. - * - * @parameter default-value="**" */ + @Parameter( defaultValue = "**") private String[] configIncludes; /** * The list of tokens to exclude when copying the configs * from partial bundle lists. - * - * @parameter */ + @Parameter private String[] configExcludes; /** * The list of names to exclude when copying properties * from partial bundle lists. - * - * @parameter */ + @Parameter private String[] propertiesExcludes; - /** - * @component - */ + @Component protected MavenFileFilter mavenFileFilter; /** * The zip unarchiver. - * - * @component role="org.codehaus.plexus.archiver.UnArchiver" roleHint="zip" */ + @Component(role = UnArchiver.class, hint = "zip") private ZipUnArchiver zipUnarchiver; private Properties slingProperties; @@ -155,14 +146,10 @@ public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo private String slingStandaloneBootstrapCommand; - /** - * @parameter default-value="${project.build.directory}/tmpBundleListconfig" - */ + @Parameter(defaultValue = "${project.build.directory}/tmpBundleListconfig") private File tmpOutputDir; - /** - * @parameter default-value="${project.build.directory}/tmpConfigDir" - */ + @Parameter(defaultValue = "${project.build.directory}/tmpConfigDir") private File tempConfigDir; private File overlayConfigDir; diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java index fe9d538..4e1529f 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java @@ -23,36 +23,33 @@ import java.io.IOException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +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.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Writer; import org.codehaus.plexus.archiver.ArchiverException; +import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.zip.ZipArchiver; import org.codehaus.plexus.util.FileUtils; /** * Attaches the bundle list as a project artifact. - * - * @goal attach-bundle-list - * @phase package - * @requiresDependencyResolution test - * @description attach the bundle list as a project artifact */ +@Mojo(name = "attach-bundle-list", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST) public class AttachBundleListMojo extends AbstractUsingBundleListMojo { - /** - * @parameter default-value="${project.build.directory}/bundleList.xml" - */ + @Parameter(defaultValue = "${project.build.directory}/bundleList.xml") private File outputFile; - /** - * @parameter default-value="${project.build.directory}/bundleListconfig" - */ + @Parameter(defaultValue = "${project.build.directory}/bundleListconfig") private File configOutputDir; /** * The zip archiver. - * - * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="zip" */ + @Component(role = UnArchiver.class, hint = "zip") private ZipArchiver zipArchiver; private final BundleListXpp3Writer writer = new BundleListXpp3Writer(); diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java index 2f4caf5..5719068 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java @@ -25,21 +25,23 @@ import java.io.IOException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +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.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Writer; import org.codehaus.plexus.archiver.ArchiverException; +import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.zip.ZipArchiver; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * Attaches the bundle list as a project artifact. - * - * @goal attach-partial-bundle-list - * @phase package - * @requiresDependencyResolution test - * @description attach the partial bundle list as a project artifact */ +@Mojo( name = "attach-partial-bundle-list", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST) public class AttachPartialBundleListMojo extends AbstractBundleListMojo { public static final String CONFIG_CLASSIFIER = "bundlelistconfig"; @@ -62,14 +64,10 @@ public class AttachPartialBundleListMojo extends AbstractBundleListMojo { public static final String SLING_STANDALONE_BOOTSTRAP = "standalone.bootstrap.txt"; - /** - * @parameter default-value="${project.build.directory}/bundleListconfig" - */ + @Parameter( defaultValue = "${project.build.directory}/bundleListconfig") private File configOutputDir; - /** - * @parameter default-value="${project.build.directory}/list.xml" - */ + @Parameter( defaultValue = "${project.build.directory}/list.xml") private File bundleListOutput; /** @@ -77,6 +75,7 @@ public class AttachPartialBundleListMojo extends AbstractBundleListMojo { * * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="zip" */ + @Component(role = UnArchiver.class, hint = "zip") private ZipArchiver zipArchiver; public void execute() throws MojoExecutionException, MojoFailureException { diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java index 59e92cf..8bd6c17 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java @@ -21,6 +21,9 @@ import java.util.List; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel; @@ -28,18 +31,14 @@ import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel; /** * Validate that the bundle list file (if it exists) does not contain references * to SNAPSHOT versions. - * - * @goal check-bundle-list-for-snapshots - * @requiresDependencyResolution test - * */ +@Mojo(name = "check-bundle-list-for-snapshots", requiresDependencyResolution = ResolutionScope.TEST) public class CheckBundleListForSnapshotsMojo extends AbstractUsingBundleListMojo { /** * True if the build should be failed if a snapshot is found. - * - * @parameter default-value="true" */ + @Parameter( defaultValue = "true") private boolean failOnSnapshot; @Override diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java index c46da9b..160828f 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java @@ -23,9 +23,15 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Resource; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +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.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel; +import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.jar.JarArchiver; import org.codehaus.plexus.util.DirectoryScanner; @@ -33,41 +39,32 @@ import org.codehaus.plexus.util.DirectoryScanner; /** * Create and attach a JAR file containing the resolved artifacts from the * bundle list. - * - * @goal create-bundle-jar - * @requiresDependencyResolution test - * @phase package - * */ +@Mojo( name = "create-bundle-jar", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST) public class CreateBundleJarMojo extends AbstractLaunchpadFrameworkMojo { /** * The list of resources we want to add to the bundle JAR file. - * - * @parameter */ + @Parameter private Resource[] resources; /** * The output directory. - * - * @parameter default-value="${project.build.directory}" */ + @Parameter( defaultValue = "${project.build.directory}") private File outputDirectory; /** * Name of the generated JAR. - * - * @parameter default-value="${project.artifactId}-${project.version}" - * @required */ + @Parameter( defaultValue = "${project.artifactId}-${project.version}", required = true) private String jarName; /** * The Jar archiver. - * - * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar" */ + @Component( role = Archiver.class, hint = "jar") private JarArchiver jarArchiver; private static final String CLASSIFIER = "bundles"; diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java index 504d9cd..1e4aca0 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java @@ -22,6 +22,10 @@ import java.io.IOException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +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.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel; @@ -32,38 +36,24 @@ import org.jdom.output.XMLOutputter; /** * Create and attach a karaf feature descriptor XML file. - * - * @goal create-karaf-descriptor - * @phase package - * @description create a karaf feature descriptor - * @requiresDependencyResolution test */ +@Mojo(name = "create-karaf-descriptor", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST) public class CreateKarafFeatureDescriptorMojo extends AbstractUsingBundleListMojo { private static final String CLASSIFIER = "features"; private static final String TYPE = "xml"; - /** - * @parameter default-value="sling" - */ + @Parameter(defaultValue = "sling") private String featureName; - /** - * @parameter default-value="sling-2.0" - */ + @Parameter(defaultValue = "sling-2.0") private String featuresName; - /** - * @parameter default-value="${project.version}" - */ + @Parameter(defaultValue = "${project.version}") private String featureVersion; - /** - * The output directory. - * - * @parameter default-value="${project.build.directory}/features.xml" - */ + @Parameter(defaultValue = "{project.build.directory}/features.xml") private File outputFile; @Override diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java index 9e98997..716f8d6 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/CreatePaxRunnerBundleProvisionFileMojo.java @@ -22,18 +22,18 @@ import java.io.IOException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +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.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel; /** * Create and attach a Pax Runner bundle provision file. - * - * @goal create-paxrunner-provision-file - * @phase package - * @description create a Pax Runner bundle provision file - * @requiresDependencyResolution test */ +@Mojo(name = "create-paxrunner-provision-file", defaultPhase = LifecyclePhase.PACKAGE, requiresDependencyResolution = ResolutionScope.TEST) public class CreatePaxRunnerBundleProvisionFileMojo extends AbstractUsingBundleListMojo { private static final String CLASSIFIER = "bundles"; @@ -42,9 +42,8 @@ public class CreatePaxRunnerBundleProvisionFileMojo extends AbstractUsingBundleL /** * The output directory. - * - * @parameter default-value="${project.build.directory}/bundles-pax" */ + @Parameter(defaultValue = "${project.build.directory}/bundles-pax") private File outputFile; @Override diff --git a/src/main/java/org/apache/sling/maven/projectsupport/DisplayBundleUpdatesMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/DisplayBundleUpdatesMojo.java index 7f11573..5aeb3af 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/DisplayBundleUpdatesMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/DisplayBundleUpdatesMojo.java @@ -35,6 +35,9 @@ import org.apache.maven.model.Dependency; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.path.PathTranslator; import org.apache.maven.settings.Settings; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle; @@ -53,9 +56,9 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; * display-dependency-updates goal from the Versions plugin. * * @since 2.0.8 - * @goal display-bundle-updates * */ +@Mojo(name = "display-bundle-updates") public class DisplayBundleUpdatesMojo extends AbstractMojo { /** @@ -63,91 +66,61 @@ public class DisplayBundleUpdatesMojo extends AbstractMojo { */ private static final int INFO_PAD_SIZE = 72; - /** - * @component - */ + @Component private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory; /** * The artifact metadata source to use. - * - * @component - * @required - * @readonly */ + @Component private ArtifactMetadataSource artifactMetadataSource; - /** - * @parameter expression="${project.remoteArtifactRepositories}" - * @readonly - */ + @Parameter( defaultValue = "${project.remoteArtifactRepositories}", readonly = true) private List<ArtifactRepository> remoteArtifactRepositories; - /** - * @parameter expression="${project.pluginArtifactRepositories}" - * @readonly - */ + @Parameter( defaultValue = "${project.pluginArtifactRepositories}", readonly = true) private List<ArtifactRepository> remotePluginRepositories; - /** - * @parameter expression="${localRepository}" - * @readonly - */ + @Parameter( defaultValue = "${localRepository}", readonly = true) private ArtifactRepository localRepository; - /** - * @component - */ + @Component private WagonManager wagonManager; - /** - * @parameter expression="${settings}" - * @readonly - */ + @Parameter(defaultValue = "${settings}", readonly = true) private Settings settings; /** * settings.xml's server id for the URL. This is used when wagon needs extra * authentication information. - * - * @parameter expression="${maven.version.rules.serverId}" - * default-value="serverId"; */ + @Parameter(property = "maven.version.rules.serverId", defaultValue = "serverId") private String serverId; /** * The Wagon URI of a ruleSet file containing the rules that control how to * compare version numbers. - * - * @parameter expression="${maven.version.rules}" */ + @Parameter(defaultValue = "maven.version.rules") private String rulesUri; /** * The Maven Session. - * - * @parameter expression="${session}" - * @required - * @readonly */ + @Parameter(defaultValue = "${session}", required = true) private MavenSession session; - /** - * @component - */ + @Component private PathTranslator pathTranslator; - /** - * @parameter default-value="${basedir}/src/main/bundles/list.xml" - */ + @Parameter(defaultValue = "${basedir}/src/main/bundles/list.xml") private File bundleListFile; /** * Whether to allow snapshots when searching for the latest version of an * artifact. - * - * @parameter expression="${allowSnapshots}" default-value="false" */ + @Parameter(property = "allowSnapshots", defaultValue = "false") private boolean allowSnapshots; /** diff --git a/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java index 31d0523..354a67a 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java @@ -21,15 +21,14 @@ import java.io.OutputStreamWriter; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Writer; /** * Output the bundle list back to the console. - * - * @goal output-bundle-list - * @requiresDependencyResolution test - * */ +@Mojo( name = "output-bundle-list", requiresDependencyResolution = ResolutionScope.TEST) public class OutputBundleListMojo extends AbstractUsingBundleListMojo { @Override diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java index e5c3612..f416c28 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java @@ -27,7 +27,13 @@ import java.util.Properties; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +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.plugins.annotations.ResolutionScope; import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList; +import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.jar.JarArchiver; @@ -38,73 +44,59 @@ import org.codehaus.plexus.util.FileUtils; /** * Initialize a Sling application project by extracting bundles into the correct * locations. - * - * @goal prepare-package - * @requiresDependencyResolution test - * @phase prepare-package - * @description initialize a Sling application project */ +@Mojo(name = "prepare-package", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.TEST) public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo { /** * The output directory for the default bundles in a WAR-packaged project, * the base JAR (in the subdirectory named in the baseDestination * parameter), and any additional bundles. - * - * @parameter default-value="${project.build.directory}/launchpad-bundles" */ + @Parameter(defaultValue = "${project.build.directory}/launchpad-bundles") private File warOutputDirectory; /** * The project's packaging type. - * - * @parameter expression="${project.packaging}" */ + @Parameter(property = "project.packaging") private String packaging; /** * The definition of the base JAR. - * - * @parameter */ + @Parameter private ArtifactDefinition base; /** * The definition of the package to be included to provide web support for * JAR-packaged projects (i.e. pax-web). - * - * @parameter */ + @Parameter private ArtifactDefinition jarWebSupport; /** * The project's build output directory (i.e. target/classes). - * - * @parameter expression="${project.build.outputDirectory}" - * @readonly */ + @Parameter(property = "project.build.outputDirectory", readonly = true) private File buildOutputDirectory; /** * The temp directory (i.e. target/maven-launchpad-plugintmp). - * - * @parameter expression="${project.build.directory}/maven-launchpad-plugintmp" - * @readonly */ + @Parameter(defaultValue = "${project.build.outputDirectory}/maven-launchpad-plugintmp", readonly = true) private File tempDirectory; /** * To look up Archiver/UnArchiver implementations - * - * @component */ + @Component private ArchiverManager archiverManager; /** * The Jar archiver. - * - * @component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar" */ + @Component(role = Archiver.class, hint = "jar") private JarArchiver jarArchiver; @Override diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PrepareTestWebAppMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PrepareTestWebAppMojo.java index d38d1cf..97a31de 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/PrepareTestWebAppMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/PrepareTestWebAppMojo.java @@ -22,42 +22,38 @@ import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +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.plugins.annotations.ResolutionScope; /** * Initialize a Sling integration test webapp by extracting bundles into the * correct locations, including the current artifact. - * - * @goal prepare-test-webapp - * @requiresDependencyResolution test - * @phase package */ +@Mojo( name = "prepare-test-webapp", requiresDependencyResolution = ResolutionScope.TEST, defaultPhase = LifecyclePhase.PACKAGE) public class PrepareTestWebAppMojo extends PreparePackageMojo { /** * The project's build directory (i.e. target). - * - * @parameter expression="${project.build.directory}" - * @readonly */ + @Parameter( property = "project.build.directory", readonly = true) private File buildDirectory; /** * The start level for the current artifact. - * - * @parameter default-value="16" */ + @Parameter( defaultValue = "16") private int startLevel; /** * The output directory for bundles. - * - * @parameter default-value="${project.build.directory}/launchpad-bundles" */ + @Parameter( defaultValue = "${project.build.directory}/launchpad-bundles") private File outputDirectory; - /** - * @component - */ + @Component private ArtifactHandlerManager artifactHandlerManager; @Override diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java index feaecd5..f34f321 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java @@ -19,17 +19,16 @@ package org.apache.sling.maven.projectsupport; import java.util.Map; import org.apache.felix.framework.Logger; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.sling.launchpad.api.LaunchpadContentProvider; import org.apache.sling.launchpad.base.impl.Sling; import org.osgi.framework.BundleException; /** * Run a Launchpad application. - * - * @goal run - * @requiresDependencyResolution test - * */ +@Mojo( name = "run", requiresDependencyResolution = ResolutionScope.TEST) public class RunMojo extends AbstractLaunchpadStartingMojo { diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java index 4a48571..75dfc17 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java @@ -19,27 +19,23 @@ package org.apache.sling.maven.projectsupport; import java.util.Map; import org.apache.felix.framework.Logger; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.sling.launchpad.api.LaunchpadContentProvider; import org.apache.sling.launchpad.base.impl.Sling; import org.osgi.framework.BundleException; /** * Start a Launchpad application. - * - * @goal start - * @requiresDependencyResolution test - * */ +@Mojo( name = "start", requiresDependencyResolution = ResolutionScope.TEST) public class StartMojo extends AbstractLaunchpadStartingMojo { - /** - * @parameter expression="${sling.control.port}" default-value="63000" - */ + @Parameter( property = "sling.control.port", defaultValue = "63000") private int controlPort; - /** - * @parameter expression="${sling.control.host}" - */ + @Parameter(property = "sling.control.host") private String controlHost; /** diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StatusMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StatusMojo.java index 95388e5..990dd97 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/StatusMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/StatusMojo.java @@ -19,24 +19,19 @@ package org.apache.sling.maven.projectsupport; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; /** * Gets the status a running Launchpad standalone application. - * - * @goal status - * @requiresProject false - * */ +@Mojo( name = "status", requiresProject = false) public class StatusMojo extends AbstractMojo { - /** - * @parameter expression="${sling.control.port}" default-value="63000" - */ + @Parameter( property = "sling.control.port", defaultValue = "63000") private int controlPort; - /** - * @parameter expression="${sling.control.host}" default-value="localhost" - */ + @Parameter( property = "sling.control.host") private String controlHost; /** diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StopMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StopMojo.java index 8fe3a8f..5d2def9 100644 --- a/src/main/java/org/apache/sling/maven/projectsupport/StopMojo.java +++ b/src/main/java/org/apache/sling/maven/projectsupport/StopMojo.java @@ -19,24 +19,19 @@ package org.apache.sling.maven.projectsupport; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; /** * Stop a running Launchpad standalone application. - * - * @goal stop - * @requiresProject false - * */ +@Mojo( name = "stop", requiresProject = false) public class StopMojo extends AbstractMojo { - /** - * @parameter expression="${sling.control.port}" default-value="63000" - */ + @Parameter( property = "sling.control.port", defaultValue = "63000") private int controlPort; - /** - * @parameter expression="${sling.control.host}" default-value="localhost" - */ + @Parameter( property = "sling.control.host") private String controlHost; /** -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
