Repository: tomee
Updated Branches:
  refs/heads/master 084603b47 -> 430f8dfc8


TOMEE-1598 main as customizer in tomee maven plugin


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/430f8dfc
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/430f8dfc
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/430f8dfc

Branch: refs/heads/master
Commit: 430f8dfc8cf34ea922f832765310fbdb482b8c9d
Parents: 084603b
Author: Romain Manni-Bucau <rmannibu...@apache.org>
Authored: Thu Jun 4 09:35:44 2015 +0200
Committer: Romain Manni-Bucau <rmannibu...@apache.org>
Committed: Thu Jun 4 09:35:44 2015 +0200

----------------------------------------------------------------------
 .../openejb/maven/plugin/AbstractTomEEMojo.java | 21 +++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/430f8dfc/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
----------------------------------------------------------------------
diff --git 
a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
 
b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
index 97bcfe1..88dc547 100644
--- 
a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
+++ 
b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
@@ -437,16 +437,23 @@ public abstract class AbstractTomEEMojo extends 
AbstractAddressMojo {
                         try {
                             final Class<?> clazz = tccl.loadClass(customizer);
                             try {
-                                final Constructor<?> cons = 
clazz.getConstructor(File.class);
-                                
Runnable.class.cast(cons.newInstance(catalinaBase)).run();
-                            } catch (final NoSuchMethodException e) {
+                                clazz.getMethod("main", String[].class)
+                                    .invoke(null, new String[] { 
catalinaBase.getAbsolutePath() });
+                            } catch (final NoSuchMethodException noMainEx) {
                                 try {
-                                    
Runnable.class.cast(clazz.newInstance()).run();
-                                } catch (final Exception e1) {
+                                    final Constructor<?> cons = 
clazz.getConstructor(File.class);
+                                    
Runnable.class.cast(cons.newInstance(catalinaBase)).run();
+                                } catch (final NoSuchMethodException e) {
+                                    try {
+                                        
Runnable.class.cast(clazz.newInstance()).run();
+                                    } catch (final Exception e1) {
+                                        throw new 
MojoExecutionException("can't create customizer: " + currentLoader, e);
+                                    }
+                                } catch (final InvocationTargetException | 
InstantiationException | IllegalAccessException e) {
                                     throw new MojoExecutionException("can't 
create customizer: " + currentLoader, e);
                                 }
-                            } catch (final InvocationTargetException | 
InstantiationException | IllegalAccessException e) {
-                                throw new MojoExecutionException("can't create 
customizer: " + currentLoader, e);
+                            } catch (final InvocationTargetException | 
IllegalAccessException e) {
+                                throw new MojoExecutionException("can't find 
customizer: " + currentLoader, e);
                             }
                         } catch (final ClassNotFoundException e) {
                             throw new MojoExecutionException("can't find 
customizer: " + currentLoader, e);

Reply via email to