Issue #2496 - Improving plugin execution skip language.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
parent
57b9f2ef22
commit
97ace5a45c
|
@ -30,7 +30,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
@ -42,6 +41,7 @@ import org.apache.maven.plugin.MojoExecutionException;
|
|||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.jetty.security.LoginService;
|
||||
import org.eclipse.jetty.server.RequestLog;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
@ -287,18 +287,27 @@ public abstract class AbstractJettyMojo extends AbstractMojo
|
|||
public abstract void restartWebApp(boolean reconfigureScanner) throws Exception;
|
||||
|
||||
|
||||
public abstract void checkPomConfiguration() throws MojoExecutionException;
|
||||
public boolean checkPomConfiguration() throws MojoExecutionException
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void configureScanner () throws MojoExecutionException;
|
||||
|
||||
|
||||
public void checkPackagingConfiguration() throws MojoExecutionException
|
||||
public boolean checkPackagingConfiguration() throws MojoExecutionException
|
||||
{
|
||||
if (!supportedPackagings.contains( project.getPackaging() ))
|
||||
{
|
||||
getLog().info( "Your project packaging is not supported by this plugin" );
|
||||
return;
|
||||
String projectName = project.getName();
|
||||
if (StringUtils.isBlank(projectName))
|
||||
{
|
||||
projectName = project.getGroupId() + ":" + project.getArtifactId();
|
||||
}
|
||||
getLog().info("Skipping " + projectName + " : packaging type [" + project.getPackaging() + "] is unsupported");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,14 +333,15 @@ public abstract class AbstractJettyMojo extends AbstractMojo
|
|||
|
||||
configurePluginClasspath();
|
||||
PluginLog.setLog(getLog());
|
||||
checkConfiguration();
|
||||
startJetty();
|
||||
if (isConfigurationSupported())
|
||||
{
|
||||
startJetty();
|
||||
}
|
||||
}
|
||||
|
||||
public void checkConfiguration() throws MojoExecutionException
|
||||
public boolean isConfigurationSupported() throws MojoExecutionException
|
||||
{
|
||||
checkPackagingConfiguration();
|
||||
checkPomConfiguration();
|
||||
return (checkPackagingConfiguration() && checkPomConfiguration());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,10 +24,8 @@ import java.net.URL;
|
|||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -181,7 +179,7 @@ public class JettyRunMojo extends AbstractJettyMojo
|
|||
* @see AbstractJettyMojo#checkPomConfiguration()
|
||||
*/
|
||||
@Override
|
||||
public void checkPomConfiguration () throws MojoExecutionException
|
||||
public boolean checkPomConfiguration () throws MojoExecutionException
|
||||
{
|
||||
// check the location of the static content/jsps etc
|
||||
try
|
||||
|
@ -238,6 +236,8 @@ public class JettyRunMojo extends AbstractJettyMojo
|
|||
{
|
||||
throw new MojoExecutionException("Location of classesDirectory does not exist");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.eclipse.jetty.maven.plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
@ -75,19 +74,7 @@ public class JettyRunWarExplodedMojo extends AbstractJettyMojo
|
|||
super.finishConfigurationBeforeStart();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see AbstractJettyMojo#checkPomConfiguration()
|
||||
*/
|
||||
@Override
|
||||
public void checkPomConfiguration() throws MojoExecutionException
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see AbstractJettyMojo#configureScanner()
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
package org.eclipse.jetty.maven.plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
@ -87,16 +86,6 @@ public class JettyRunWarMojo extends AbstractJettyMojo
|
|||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see AbstractJettyMojo#checkPomConfiguration()
|
||||
*/
|
||||
@Override
|
||||
public void checkPomConfiguration() throws MojoExecutionException
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AbstractJettyMojo#configureScanner()
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue