You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2015/10/07 09:57:57 UTC
svn commit: r1707197 - in /sling/trunk/tooling/maven/maven-sling-plugin: ./
src/main/java/org/apache/sling/maven/bundlesupport/
Author: rombert
Date: Wed Oct 7 07:57:57 2015
New Revision: 1707197
URL: http://svn.apache.org/viewvc?rev=1707197&view=rev
Log:
SLING-5107 - Switch to Java annotations for Maven plugins
Switch to Java annotations for the maven-sling-plugin
Modified:
sling/trunk/tooling/maven/maven-sling-plugin/pom.xml
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployFileMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleUninstallMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
Modified: sling/trunk/tooling/maven/maven-sling-plugin/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/pom.xml?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/pom.xml (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/pom.xml Wed Oct 7 07:57:57 2015
@@ -27,7 +27,6 @@
<relativePath/>
</parent>
- <groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<version>2.1.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
@@ -43,13 +42,29 @@
<url>http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin</url>
</scm>
- <reporting>
+ <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
- <version>2.5.1</version>
- </plugin>
+ <executions>
+ <execution>
+ <id>default-descriptor</id>
+ <phase>process-classes</phase>
+ </execution>
+ <execution>
+ <id>help-goal</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -123,5 +138,11 @@
<artifactId>asm-all</artifactId>
<version>3.3.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.4</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java Wed Oct 7 07:57:57 2015
@@ -39,16 +39,15 @@ import org.apache.commons.httpclient.met
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.apache.commons.io.IOUtils;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Parameter;
abstract class AbstractBundleDeployMojo extends AbstractBundlePostMojo {
/**
* The URL to the OSGi Bundle repository to which the bundle is posted, e.g.
* <code>http://obr.sample.com</code>
- *
- * @parameter expression="${obr}"
- * @required
*/
+ @Parameter(required = true, property="obr")
private String obr;
/**
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java Wed Oct 7 07:57:57 2015
@@ -45,6 +45,7 @@ import org.apache.commons.httpclient.met
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.sling.commons.json.JSONArray;
import org.apache.sling.commons.json.JSONException;
@@ -65,11 +66,8 @@ abstract class AbstractBundleInstallMojo
/**
* The URL of the running Sling instance.
- *
- * @parameter expression="${sling.url}"
- * default-value="http://localhost:8080/system/console"
- * @required
*/
+ @Parameter(property="sling.url", defaultValue="http://localhost:8080/system/console", required = true)
protected String slingUrl;
/**
@@ -79,86 +77,65 @@ abstract class AbstractBundleInstallMojo
* POM (eg. <code>sling.url=http://localhost:8080</code> and
* <code>sling.urlSuffix=/project/specific/path</code>). This is typically used
* in conjunction with a HTTP PUT (<code>sling.usePut=true</code>).
- *
- * @parameter expression="${sling.urlSuffix}"
*/
+ @Parameter(property="sling.urlSuffix")
protected String slingUrlSuffix;
/**
* If a simple HTTP PUT should be used instead of the standard POST to the
* felix console. In the <code>uninstall</code> goal, a HTTP DELETE will be
* used.
- *
- * @parameter expression="${sling.usePut}" default-value="false"
- * @required
*/
+ @Parameter(property="sling.usePut", defaultValue = "false", required = true)
protected boolean usePut;
/**
* The content type / mime type used for the HTTP PUT (if
* <code>sling.usePut=true</code>).
- *
- * @parameter expression="${sling.mimeType}"
- * default-value="application/java-archive"
- * @required
*/
+ @Parameter(property="sling.mimeType", defaultValue = "application/java-archive", required = true)
protected String mimeType;
/**
* The user name to authenticate at the running Sling instance.
- *
- * @parameter expression="${sling.user}" default-value="admin"
- * @required
*/
+ @Parameter(property="sling.user", defaultValue = "admin", required = true)
private String user;
/**
* The password to authenticate at the running Sling instance.
- *
- * @parameter expression="${sling.password}" default-value="admin"
- * @required
*/
+ @Parameter(property="sling.password", defaultValue = "admin", required = true)
private String password;
/**
* The startlevel for the uploaded bundle
- *
- * @parameter expression="${sling.bundle.startlevel}" default-value="20"
- * @required
*/
+ @Parameter(property="sling.bundle.startlevel", defaultValue = "20", required = true)
private String bundleStartLevel;
/**
* Whether to start the uploaded bundle or not
- *
- * @parameter expression="${sling.bundle.start}" default-value="true"
- * @required
*/
+ @Parameter(property="sling.bundle.start", defaultValue = "true", required = true)
private boolean bundleStart;
/**
* Whether to refresh the packages after installing the uploaded bundle
- *
- * @parameter expression="${sling.refreshPackages}" default-value="true"
- * @required
*/
+ @Parameter(property="sling.refreshPackages", defaultValue = "true", required = true)
private boolean refreshPackages;
/**
* Whether to add the mapping for the fs provider
- *
- * @parameter expression="${sling.mountByFS}" default-value="false"
- * @required
*/
+ @Parameter(property="sling.mountByFS", defaultValue = "false", required = true)
private boolean mountByFS;
/**
* The Maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
*/
+ @Parameter(defaultValue = "${project}", required = true, readonly = true)
protected MavenProject project;
public AbstractBundleInstallMojo() {
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java Wed Oct 7 07:57:57 2015
@@ -24,16 +24,15 @@ import java.util.jar.JarFile;
import java.util.jar.Manifest;
import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.Parameter;
abstract class AbstractBundlePostMojo extends AbstractMojo {
/**
* Determines whether or not to fail the build if
* the HTTP POST or PUT returns an non-OK response code.
- *
- * @parameter expression="${sling.failOnError}" default-value="true"
- * @required
*/
+ @Parameter(property = "sling.failOnError", defaultValue = "true", required = true)
protected boolean failOnError;
/**
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployFileMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployFileMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployFileMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployFileMojo.java Wed Oct 7 07:57:57 2015
@@ -21,24 +21,22 @@ package org.apache.sling.maven.bundlesup
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
/**
* Deploy a JAR representing an OSGi Bundle. This method posts the bundle built
* by maven to an OSGi Bundle Repository accepting the bundle. The plugin uses
* a </em>multipart/format-data</em> POST request to just post the file to
* the URL configured in the <code>obr</code> property.
- *
- * @goal deploy-file
- * @requiresProject false
- * @description deploy an OSGi bundle jar to the Day OBR
*/
+@Mojo(name="deploy-file", requiresProject= false)
public class BundleDeployFileMojo extends AbstractBundleDeployMojo {
/**
* The name of the generated JAR file.
- *
- * @parameter expression="${sling.file}"
*/
+ @Parameter(property="sling.file")
private String bundleFileName;
@Override
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleDeployMojo.java Wed Oct 7 07:57:57 2015
@@ -22,6 +22,9 @@ import java.io.File;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;
import org.apache.maven.plugin.MojoExecutionException;
+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;
/**
@@ -29,11 +32,8 @@ import org.apache.maven.project.MavenPro
* by maven to an OSGi Bundle Repository accepting the bundle. The plugin uses
* a </em>multipart/format-data</em> POST request to just post the file to
* the URL configured in the <code>obr</code> property.
- *
- * @goal deploy
- * @phase deploy
- * @description deploy an OSGi bundle jar to an OBR
*/
+@Mojo(name = "deploy", defaultPhase = LifecyclePhase.DEPLOY)
public class BundleDeployMojo extends AbstractBundleDeployMojo {
/**
@@ -41,10 +41,8 @@ public class BundleDeployMojo extends Ab
* project to be executed. This property may be set by the
* <code>sling.deploy.skip</code> comparable to the <code>maven.test.skip</code>
* property to prevent running the unit tests.
- *
- * @parameter expression="${sling.deploy.skip}" default-value="false"
- * @required
*/
+ @Parameter(property = "sling.deploy.skip", defaultValue = "false", required = true)
private boolean skip;
/**
@@ -53,23 +51,19 @@ public class BundleDeployMojo extends Ab
* @parameter expression="${project.build.directory}"
* @required
*/
+ @Parameter(defaultValue = "${project.build.directory}", readonly = true)
private String buildDirectory;
/**
* The name of the generated JAR file.
- *
- * @parameter alias="jarName" expression="${project.build.finalName}.jar"
- * @required
*/
+ @Parameter(property = "project.build.finalName", alias = "jarName", required = true)
private String jarName;
/**
* The Maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${project}", readonly = true )
private MavenProject project;
@Override
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallFileMojo.java Wed Oct 7 07:57:57 2015
@@ -29,108 +29,87 @@ import org.apache.maven.artifact.reposit
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
import org.codehaus.plexus.util.StringUtils;
/**
* Install an OSGi bundle to a running Sling instance.
- *
- * @goal install-file
- * @description install an OSGi bundle jar to a running Sling instance
- * @requiresProject false
*/
+@Mojo(name = "install-file", requiresProject = false)
public class BundleInstallFileMojo extends AbstractBundleInstallMojo {
/**
* The name of the generated JAR file.
- *
- * @parameter expression="${sling.file}"
*/
+ @Parameter(property="sling.file")
private String bundleFileName;
/**
* The groupId of the artifact to install
- * @parameter expression="${sling.groupId}"
*/
+ @Parameter(property="sling.groupId")
private String groupId;
/**
* The artifactId of the artifact to install
- * @parameter expression="${sling.artifactId}"
*/
+ @Parameter(property="sling.artifactId")
private String artifactId;
/**
* The version of the artifact to install
- * @parameter expression="${sling.version}"
*/
+ @Parameter(property="sling.version")
private String version;
/**
* The packaging of the artifact to install
- * @parameter expression="${sling.packaging}" default-value="jar"
*/
+ @Parameter(property="sling.packaging", defaultValue="jar")
private String packaging = "jar";
/**
* The classifier of the artifact to install
- * @parameter expression="${sling.classifier}"
*/
+ @Parameter(property="sling.classifier")
private String classifier;
/**
* A string of the form groupId:artifactId:version[:packaging[:classifier]].
- * @parameter expression="${sling.artifact}"
*/
+ @Parameter(property="sling.artifact")
private String artifact;
- /**
- *
- * @parameter expression="${project.remoteArtifactRepositories}"
- * @required
- * @readonly
- */
+ @Parameter(property="project.remoteArtifactRepositories", required = true, readonly = true)
private List pomRemoteRepositories;
/**
* The id of the repository from which we'll download the artifact
- * @parameter expression="${sling.repoId}" default-value="temp"
*/
+ @Parameter(property = "sling.repoId", defaultValue = "temp")
private String repositoryId = "temp";
/**
* The url of the repository from which we'll download the artifact
- * @parameter expression="${sling.repoUrl}"
*/
+ @Parameter(property = "sling.repoUrl")
private String repositoryUrl;
- /**
- * @component
- * @readonly
- */
+ @Component
private ArtifactFactory artifactFactory;
- /**
- * @component
- * @readonly
- */
+ @Component
private ArtifactResolver artifactResolver;
- /**
- * @component
- * @readonly
- */
+ @Component
private ArtifactRepositoryFactory artifactRepositoryFactory;
- /**
- * @component roleHint="default"
- */
+ @Component(hint="default")
private ArtifactRepositoryLayout repositoryLayout;
- /**
- *
- * @parameter expression="${localRepository}"
- * @readonly
- */
+ @Parameter(property="localRepository", readonly = true)
private ArtifactRepository localRepository;
@Override
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleInstallMojo.java Wed Oct 7 07:57:57 2015
@@ -18,14 +18,14 @@
package org.apache.sling.maven.bundlesupport;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
/**
* Install an OSGi bundle to a running Sling instance.
- *
- * @goal install
- * @phase install
- * @description install an OSGi bundle jar to a running Sling instance
*/
+@Mojo(name = "install", defaultPhase = LifecyclePhase.INSTALL)
public class BundleInstallMojo extends AbstractBundleInstallMojo {
/**
@@ -33,18 +33,14 @@ public class BundleInstallMojo extends A
* project to be executed. This property may be set by the
* <code>sling.install.skip</code> comparable to the <code>maven.test.skip</code>
* property to prevent running the unit tests.
- *
- * @parameter expression="${sling.install.skip}" default-value="false"
- * @required
*/
+ @Parameter(property = "sling.install.skip", defaultValue = "false", required = true)
private boolean skip;
/**
* The name of the generated JAR file.
- *
- * @parameter expression="${sling.file}" default-value="${project.build.directory}/${project.build.finalName}.jar"
- * @required
*/
+ @Parameter(property = "sling.file", defaultValue = "${project.build.directory}/${project.build.finalName}.jar", required = true)
private String bundleFileName;
@Override
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleUninstallMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleUninstallMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleUninstallMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/BundleUninstallMojo.java Wed Oct 7 07:57:57 2015
@@ -27,21 +27,19 @@ import org.apache.commons.httpclient.Htt
import org.apache.commons.httpclient.methods.DeleteMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
/**
* Uninstall an OSGi bundle from a running Sling instance.
- *
- * @goal uninstall
- * @description uninstall an OSGi bundle from a running Sling instance
*/
+@Mojo(name = "uninstall")
public class BundleUninstallMojo extends AbstractBundleInstallMojo {
/**
* The name of the generated JAR file.
- *
- * @parameter expression="${sling.file}" default-value="${project.build.directory}/${project.build.finalName}.jar"
- * @required
*/
+ @Parameter(property = "sling.file", defaultValue = "${project.build.directory}/${project.build.finalName}.jar")
private String bundleFileName;
@Override
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/GenerateAdapterMetadataMojo.java Wed Oct 7 07:57:57 2015
@@ -34,6 +34,10 @@ import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
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.maven.project.MavenProject;
import org.apache.sling.adapter.annotations.Adaptable;
import org.apache.sling.adapter.annotations.Adaptables;
@@ -48,12 +52,10 @@ import org.objectweb.asm.tree.ClassNode;
import org.scannotation.AnnotationDB;
/**
- * @goal generate-adapter-metadata
- * @phase process-classes
- * @threadSafe
- * @description Build Adapter Metadata from Annotated Classes
- * @requiresDependencyResolution compile
+ * Build Adapter Metadata from Annotated Classes
*/
+@Mojo(name="generate-adapter-metadata", defaultPhase = LifecyclePhase.PROCESS_CLASSES,
+ threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE)
public class GenerateAdapterMetadataMojo extends AbstractMojo {
private static final int JSON_INDENTATION = 4;
@@ -74,36 +76,22 @@ public class GenerateAdapterMetadataMojo
}
}
- /**
- * @parameter expression="${project.build.outputDirectory}"
- * @required
- * @readonly
- */
+ @Parameter(defaultValue = "${project.build.outputDirectory}", readonly = true)
private File buildOutputDirectory;
/**
* Name of the generated descriptor file.
- *
- * @parameter expression="${adapter.descriptor.name}"
- * default-value="SLING-INF/adapters.json"
*/
+ @Parameter(property = "adapter.descriptor.name", defaultValue = "SLING-INF/adapters.json")
private String fileName;
- /**
- * @parameter
- * expression="${project.build.directory}/adapter-plugin-generated"
- * @required
- * @readonly
- */
+ @Parameter(defaultValue = "${project.build.directory}/adapter-plugin-generated", required = true, readonly = true)
private File outputDirectory;
/**
* The Maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${project}", readonly = true )
private MavenProject project;
public void execute() throws MojoExecutionException, MojoFailureException {
Modified: sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java?rev=1707197&r1=1707196&r2=1707197&view=diff
==============================================================================
--- sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java (original)
+++ sling/trunk/tooling/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/ValidationMojo.java Wed Oct 7 07:57:57 2015
@@ -27,6 +27,9 @@ import org.apache.commons.io.IOUtils;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
+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;
import org.apache.sling.commons.json.JSONException;
import org.apache.sling.commons.json.util.Validator;
@@ -35,35 +38,26 @@ import org.codehaus.plexus.util.Director
/**
* Plugin to validate resources:
* - validate json files
- *
- * @goal validate
- * @phase process-resources
*/
+@Mojo(name = "validate", defaultPhase = LifecyclePhase.PROCESS_RESOURCES)
public class ValidationMojo extends AbstractMojo {
/**
* The Maven project.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
*/
+ @Parameter( defaultValue = "${project}", readonly = true )
private MavenProject project;
/**
* Whether to skip the validation
- *
- * @parameter expression="${sling.validation.skip}" default-value="false"
- * @required
*/
+ @Parameter(property = "sling.validation.skip", defaultValue = "false", required = true)
private boolean skip;
/**
* Whether to skip the json validation
- *
- * @parameter expression="${sling.validation.skipJson}" default-value="false"
- * @required
*/
+ @Parameter(property = "sling.validation.skipJson", defaultValue = "false", required = true)
private boolean skipJson;
/**