]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/EquinoxExecMojo.java
Add some variables.
[gpl/argeo-slc.git] / maven / maven-argeo-osgi-plugin / src / main / java / org / argeo / slc / maven / plugins / osgi / EquinoxExecMojo.java
index c483c5250a3fd412845d4a5c3881ee1d668925c4..ea75a22838a001497edb694eb11666a981d19647 100644 (file)
@@ -55,8 +55,23 @@ public class EquinoxExecMojo extends AbstractOsgiMojo {
         */
        protected String[] jvmArgs;
 
+       /**
+        * JVM arguments to append
+        * 
+        * @parameter alias="${jvmArgsToAppend}"
+        */
+       protected String[] jvmArgsToAppend;
+
        protected String[] defaultJvmArgs = { "-Xmx128m" };
 
+       /**
+        * Debug port (0 deactivate)
+        * 
+        * @parameter expression="${debug}" default-value="0"
+        * @required
+        */
+       protected String debug;
+
        /**
         * Equinox args
         * 
@@ -64,6 +79,13 @@ public class EquinoxExecMojo extends AbstractOsgiMojo {
         */
        protected String[] args;
 
+       /**
+        * Equinox args to append
+        * 
+        * @parameter alias="${argsToAppend}"
+        */
+       protected String[] argsToAppend;
+
        protected String[] defaultArgs = { "-console", "-configuration", "conf",
                        "-data", "data" };
 
@@ -140,8 +162,20 @@ public class EquinoxExecMojo extends AbstractOsgiMojo {
 
                        // Build command
                        List cmdList = new ArrayList();
+                       // JVM
                        cmdList.add(jvm);
+                       // JVM arguments
                        cmdList.addAll(Arrays.asList(jvmArgs));
+
+                       if (!"0".equals(debug))
+                               cmdList
+                                               .add("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address="
+                                                               + debug);
+
+                       if (jvmArgsToAppend != null)
+                               cmdList.addAll(Arrays.asList(jvmArgsToAppend));
+
+                       // System properties
                        if (!systemProperties.containsKey("osgi.bundles"))
                                cmdList.add("-Dosgi.bundles="
                                                + osgiBootArtifact.getFile().getCanonicalPath()
@@ -160,9 +194,15 @@ public class EquinoxExecMojo extends AbstractOsgiMojo {
                                }
                                cmdList.add("-D" + key + "=" + strValue);
                        }
+
+                       // Equinox jar
                        cmdList.add("-jar");
                        cmdList.add(equinoxArtifact.getFile().getCanonicalPath());
+
+                       // Program arguments
                        cmdList.addAll(Arrays.asList(args));
+                       if (argsToAppend != null)
+                               cmdList.addAll(Arrays.asList(argsToAppend));
 
                        String[] cmd = (String[]) cmdList.toArray(new String[0]);