From 42d9da56c0292467074789bd557b803f1adc7269 Mon Sep 17 00:00:00 2001
From: Olivier Lamy
war
packaging.
* If your project use an other type please configure it here.
*
- * @parameter
*/
+ @Parameter
protected List@@ -36,13 +41,11 @@ import org.apache.maven.plugin.MojoFailureException; * This goal is useful e.g. for launching a web app in Jetty as a target for unit-tested * HTTP client components. *
- * - * @goal deploy-war - * @requiresDependencyResolution runtime - * @execute phase="validate" - * @description Deploy a pre-assembled war + * Deploy a pre-assembled war * */ +@Mojo( name = "deploy-war", requiresDependencyResolution = ResolutionScope.RUNTIME) +@Execute(phase = LifecyclePhase.VALIDATE) public class JettyDeployWar extends JettyRunWarMojo { @@ -52,9 +55,8 @@ public class JettyDeployWar extends JettyRunWarMojo * plugin will block further execution and you will need to use * cntrl-c to stop it. * - * - * @parameter default-value="true" */ + @Parameter(defaultValue = "true") protected boolean daemon = true; diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java index e00aa76cd29..8208290abea 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyEffectiveWebXml.java @@ -24,6 +24,11 @@ import java.io.IOException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +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.plugins.annotations.ResolutionScope; import org.eclipse.jetty.annotations.AnnotationConfiguration; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.resource.Resource; @@ -37,31 +42,25 @@ import org.eclipse.jetty.util.thread.QueuedThreadPool; * * See http://www.eclipse.org/jetty/documentation for more information on this and other jetty plugins. * - * @goal effective-web-xml - * @requiresDependencyResolution test - * @execute phase="test-compile" - * @description Runs jetty on the unassembled webapp to generate the effective web.xml + * Runs jetty on the unassembled webapp to generate the effective web.xml */ +@Mojo( name = "effective-web-xml", requiresDependencyResolution = ResolutionScope.TEST) +@Execute(phase = LifecyclePhase.TEST_COMPILE) public class JettyEffectiveWebXml extends JettyRunMojo { /** * The target directory - * - * @parameter default-value="${project.build.directory}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true) protected File target; /** * The name of the file to generate into * - * @parameter */ + @Parameter protected File effectiveWebXml; - - - + protected boolean deleteOnExit = true; @@ -79,9 +78,7 @@ public class JettyEffectiveWebXml extends JettyRunMojo public void startJetty() throws MojoExecutionException { //Only do enough setup to be able to produce a quickstart-web.xml file - - QueuedThreadPool tpool = null; try diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunDistro.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunDistro.java index ed8f3dcec86..1fd6ecb727d 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunDistro.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunDistro.java @@ -48,6 +48,12 @@ import org.apache.maven.model.Dependency; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.plugins.annotations.Component; +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.plugins.annotations.ResolutionScope; import org.apache.maven.project.DefaultProjectBuildingRequest; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.shared.artifact.DefaultArtifactCoordinate; @@ -76,12 +82,11 @@ import org.eclipse.jetty.util.resource.Resource; * * See http://www.eclipse.org/jetty/documentation for more information on this and other jetty plugins. * - * @goal run-distro - * @requiresDependencyResolution test - * @execute phase="test-compile" - * @description Runs unassembled webapp in a locally installed jetty distro + * Runs unassembled webapp in a locally installed jetty distro * */ +@Mojo( name = "run-distro", requiresDependencyResolution = ResolutionScope.TEST) +@Execute(phase = LifecyclePhase.TEST_COMPILE) public class JettyRunDistro extends JettyRunMojo { @@ -91,112 +96,99 @@ public class JettyRunDistro extends JettyRunMojo /** * This plugin - * - * @parameter default-value="${plugin}" - * @readonly - * @required */ + @Parameter(defaultValue = "${plugin}", required = true, readonly = true) protected PluginDescriptor plugin; /** * The target directory - * - * @parameter default-value="${project.build.directory}" - * @required - * @readonly */ + @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true) protected File target; /** * Optional jetty.home dir - * @parameter + * */ + @Parameter private File jettyHome; /** * Optional jetty.base dir - * @parameter + * */ + @Parameter private File jettyBase; /** * Optional list of other modules to * activate. - * @parameter */ + @Parameter private String[] modules; /** * Arbitrary jvm args to pass to the forked process - * @parameter property="jetty.jvmArgs" + * */ + @Parameter(property = "jetty.jvmArgs") private String jvmArgs; /** * Extra environment variables to be passed to the forked process - * - * @parameter + * */ - private Map
* See http://www.eclipse.org/jetty/documentation for more information on this and other jetty plugins.
*
- * @goal run-forked
- * @requiresDependencyResolution test
- * @execute phase="test-compile"
- * @description Runs Jetty in forked JVM on an unassembled webapp
+ * Runs Jetty in forked JVM on an unassembled webapp
*
*/
+@Mojo( name = "run-forked", requiresDependencyResolution = ResolutionScope.TEST)
+@Execute(phase = LifecyclePhase.TEST_COMPILE)
public class JettyRunForkedMojo extends JettyRunMojo
{
/**
* The target directory
- *
- * @parameter default-value="${project.build.directory}"
- * @required
- * @readonly
*/
+ @Parameter(defaultValue="${project.build.directory}", readonly = true, required = true)
protected File target;
/**
* The file into which to generate the quickstart web xml for the forked process to use
- *
- * @parameter default-value="${project.build.directory}/fork-web.xml"
+ *
*/
+ @Parameter(defaultValue="${project.build.directory}/fork-web.xml")
protected File forkWebXml;
/**
* Arbitrary jvm args to pass to the forked process
- * @parameter property="jetty.jvmArgs"
+ *
*/
+ @Parameter(property="jetty.jvmArgs")
private String jvmArgs;
/**
* Optional list of jetty properties to put on the command line
- * @parameter
+ *
*/
+ @Parameter
private String[] jettyProperties;
-
- /**
- * @parameter default-value="${plugin.artifacts}"
- * @readonly
- */
- private List pluginArtifacts;
-
-
- /**
- * @parameter default-value="${plugin}"
- * @readonly
- */
+ @Parameter(defaultValue="${plugin.artifacts}",readonly = true)
+ private List
* There is a reference guide to the configuration parameters for this plugin.
*
- * @goal run
- * @requiresDependencyResolution test
- * @execute phase="test-compile"
- * @description Runs jetty directly from a maven project
+ * Runs jetty directly from a maven project
*/
+@Mojo( name = "run", requiresDependencyResolution = ResolutionScope.TEST)
+@Execute(phase = LifecyclePhase.TEST_COMPILE)
public class JettyRunMojo extends AbstractJettyMojo
{
public static final String DEFAULT_WEBAPP_SRC = "src"+File.separator+"main"+File.separator+"webapp";
@@ -77,69 +80,61 @@ public class JettyRunMojo extends AbstractJettyMojo
* If true, the <testOutputDirectory>
* and the dependencies of <scope>test<scope>
* will be put first on the runtime classpath.
- *
- * @parameter alias="useTestClasspath" default-value="false"
+ *
*/
+ @Parameter(alias="useTestClasspath", defaultValue="false")
protected boolean useTestScope;
/**
* The default location of the web.xml file. Will be used
* if <webApp><descriptor> is not set.
- *
- * @parameter default-value="${maven.war.webxml}"
- * @readonly
+ *
*/
+ @Parameter(defaultValue="${maven.war.webxml}", readonly = true)
protected String webXml;
/**
* The directory containing generated classes.
*
- * @parameter default-value="${project.build.outputDirectory}"
- * @required
- *
*/
+ @Parameter(defaultValue="${project.build.outputDirectory}", required = true)
protected File classesDirectory;
/**
* An optional pattern for includes/excludes of classes in the classesDirectory
- * @parameter
+ *
*/
+ @Parameter
protected ScanPattern scanClassesPattern;
-
-
-
-
+
/**
* The directory containing generated test classes.
- *
- * @parameter default-value="${project.build.testOutputDirectory}"
- * @required
+ *
*/
+ @Parameter(defaultValue="${project.build.testOutputDirectory}", required = true)
protected File testClassesDirectory;
/**
* An optional pattern for includes/excludes of classes in the testClassesDirectory
- * @parameter
+ *
*/
+ @Parameter
protected ScanPattern scanTestClassesPattern;
-
-
-
+
/**
* Root directory for all html/jsp etc files
*
- * @parameter default-value="${maven.war.src}"
- *
*/
+ @Parameter(defaultValue="${maven.war.src}")
protected File webAppSourceDirectory;
/**
* List of files or directories to additionally periodically scan for changes. Optional.
- * @parameter
*/
+ @Parameter
protected File[] scanTargets;
@@ -147,8 +142,9 @@ public class JettyRunMojo extends AbstractJettyMojo
* List of directories with ant-style <include> and <exclude> patterns
* for extra targets to periodically scan for changes. Can be used instead of,
* or in conjunction with <scanTargets>.Optional.
- * @parameter
+ *
*/
+ @Parameter
protected ScanTargetPattern[] scanTargetPatterns;
@@ -336,20 +332,7 @@ public class JettyRunMojo extends AbstractJettyMojo
getLog().info( "web.xml file = "+webApp.getDescriptor());
getLog().info("Webapp directory = " + webAppSourceDirectory.getCanonicalPath());
}
-
- private static File toFile(Resource resource)
- {
- try
- {
- return resource.getFile();
- }
- catch ( IOException e )
- {
- throw new RuntimeException( e.getMessage(), e );
- }
- }
-
/**
* @see org.eclipse.jetty.maven.plugin.AbstractJettyMojo#configureScanner()
*/
@@ -366,7 +349,7 @@ public class JettyRunMojo extends AbstractJettyMojo
throw new MojoExecutionException("Error forming scan list", e);
}
- scanner.addListener(new PathWatcher.EventListListener()
+ scanner.addListener( new PathWatcher.EventListListener()
{
@Override
@@ -549,10 +532,8 @@ public class JettyRunMojo extends AbstractJettyMojo
private List