[MTOMCAT-306]
Allow port reuse when invoking plugin repeatedly in build
fixes #17
Signed-off-by: olivier lamy <olamy@apache.org>
git-svn-id: https://svn.apache.org/repos/asf/tomcat/maven-plugin/trunk@1737760 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/EmbeddedRegistry.java b/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/EmbeddedRegistry.java
index 7eb1cce..c02334e 100644
--- a/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/EmbeddedRegistry.java
+++ b/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/EmbeddedRegistry.java
@@ -108,6 +108,7 @@
{
Method method = embedded.getClass().getMethod( "stop", null );
method.invoke( embedded, null );
+ embedded.getClass().getMethod( "destroy", null ).invoke( embedded, null );
iterator.remove();
}
catch ( NoSuchMethodException e )
@@ -115,7 +116,7 @@
if ( firstException == null )
{
firstException = e;
- error( log, e, "no stop method in class " + embedded.getClass().getName() );
+ error( log, e, "no stop/destroy method in class " + embedded.getClass().getName() );
}
else
{
@@ -127,7 +128,7 @@
if ( firstException == null )
{
firstException = e;
- error( log, e, "IllegalAccessException for stop method in class " + embedded.getClass().getName() );
+ error( log, e, "IllegalAccessException for stop/destroy method in class " + embedded.getClass().getName() );
}
else
{
@@ -140,7 +141,7 @@
if ( firstException == null )
{
firstException = e;
- error( log, e, "IllegalAccessException for stop method in class " + embedded.getClass().getName() );
+ error( log, e, "IllegalAccessException for stop/destroy method in class " + embedded.getClass().getName() );
}
else
{