Issue #2209 Require war packaging only for some jetty maven plugin goals.

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2018-02-22 10:55:25 +11:00
parent 1e76caf00d
commit 85ed19ce3f
7 changed files with 70 additions and 16 deletions

View File

@ -293,8 +293,9 @@ public abstract class AbstractJettyMojo extends AbstractMojo
public abstract void restartWebApp(boolean reconfigureScanner) throws Exception;
public abstract void checkPomConfiguration() throws MojoExecutionException;
public abstract void checkPomConfiguration() throws MojoExecutionException;
public abstract void checkPackagingConfiguration() throws MojoExecutionException;
public abstract void configureScanner () throws MojoExecutionException;
@ -323,11 +324,15 @@ public abstract class AbstractJettyMojo extends AbstractMojo
configurePluginClasspath();
PluginLog.setLog(getLog());
checkPomConfiguration();
checkConfiguration();
startJetty();
}
public void checkConfiguration() throws MojoExecutionException
{
checkPackagingConfiguration();
checkPomConfiguration();
}
public void configurePluginClasspath() throws MojoExecutionException

View File

@ -67,6 +67,23 @@ public class JettyDeployWar extends JettyRunWarMojo
/**
* @see org.eclipse.jetty.maven.plugin.JettyRunWarMojo#checkPackagingConfiguration()
*/
@Override
public void checkPackagingConfiguration() throws MojoExecutionException
{
return; //do not require this to be a war project
}
@Override
public void finishConfigurationBeforeStart() throws Exception
{

View File

@ -175,17 +175,25 @@ public class JettyRunMojo extends AbstractJettyMojo
@Override
public void execute() throws MojoExecutionException, MojoFailureException
{
if ( !"war".equals( project.getPackaging() ) || skip )
{
return;
}
warPluginInfo = new WarPluginInfo(project);
super.execute();
}
/**
* @see org.eclipse.jetty.maven.plugin.AbstractJettyMojo#checkPackagingConfiguration()
*/
@Override
public void checkPackagingConfiguration() throws MojoExecutionException
{
if ( !"war".equals( project.getPackaging() ))
throw new MojoExecutionException("Not war packaging");
}
/**
* Verify the configuration given in the pom.
*

View File

@ -79,6 +79,17 @@ public class JettyRunWarExplodedMojo extends AbstractJettyMojo
}
/**
* @see org.eclipse.jetty.maven.plugin.AbstractJettyMojo#checkPackagingConfiguration()
*/
@Override
public void checkPackagingConfiguration() throws MojoExecutionException
{
if ( !"war".equals( project.getPackaging() ))
throw new MojoExecutionException("Not war packaging");
}
/**
*
* @see AbstractJettyMojo#checkPomConfiguration()

View File

@ -61,10 +61,6 @@ public class JettyRunWarMojo extends AbstractJettyMojo
*/
public void execute() throws MojoExecutionException, MojoFailureException
{
if ( !"war".equals( project.getPackaging() ) || skip )
{
return;
}
super.execute();
}
@ -96,7 +92,18 @@ public class JettyRunWarMojo extends AbstractJettyMojo
return;
}
/**
* @see org.eclipse.jetty.maven.plugin.AbstractJettyMojo#checkPackagingConfiguration()
*/
@Override
public void checkPackagingConfiguration() throws MojoExecutionException
{
if ( !"war".equals( project.getPackaging() ))
throw new MojoExecutionException("Not war packaging");
}
/**

View File

@ -48,7 +48,15 @@ public class JettyStartMojo extends JettyRunMojo
super.execute();
}
/**
* @see org.eclipse.jetty.maven.plugin.AbstractJettyMojo#checkPackagingConfiguration()
*/
@Override
public void checkPackagingConfiguration() throws MojoExecutionException
{
return; //don't check that the project is a war
}
@Override
public void finishConfigurationBeforeStart() throws Exception
{

View File

@ -62,9 +62,7 @@ public class JettyStopMojo extends AbstractMojo
* @parameter
*/
protected int stopWait;