From b3dd8e4322040c185f413f85f14a3151b792624b Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sat, 25 Apr 2009 13:15:25 +0000 Subject: [PATCH] Update equinox execution git-svn-id: https://svn.argeo.org/slc/trunk@2357 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- maven/maven-argeo-osgi-plugin/pom.xml | 2 +- .../maven/plugins/osgi/EquinoxExecMojo.java | 41 +++++++++++++++---- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/maven/maven-argeo-osgi-plugin/pom.xml b/maven/maven-argeo-osgi-plugin/pom.xml index 0b7552483..b7f2b6699 100644 --- a/maven/maven-argeo-osgi-plugin/pom.xml +++ b/maven/maven-argeo-osgi-plugin/pom.xml @@ -7,7 +7,7 @@ .. maven-argeo-osgi-plugin - 0.1.6 + 0.1.7 maven-plugin Argeo OSGi Plugin diff --git a/maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/EquinoxExecMojo.java b/maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/EquinoxExecMojo.java index 7f54edd3d..c483c5250 100644 --- a/maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/EquinoxExecMojo.java +++ b/maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/EquinoxExecMojo.java @@ -55,7 +55,7 @@ public class EquinoxExecMojo extends AbstractOsgiMojo { */ protected String[] jvmArgs; - protected String[] defaultJvmArgs = { "-Xmx256m" }; + protected String[] defaultJvmArgs = { "-Xmx128m" }; /** * Equinox args @@ -64,8 +64,8 @@ public class EquinoxExecMojo extends AbstractOsgiMojo { */ protected String[] args; - protected String[] defaultArgs = { "-clean", "-console", "-configuration", - "conf" }; + protected String[] defaultArgs = { "-console", "-configuration", "conf", + "-data", "data" }; /** * JVM system properties @@ -78,11 +78,18 @@ public class EquinoxExecMojo extends AbstractOsgiMojo { * Execution directory * * @parameter expression="${execDir}" + * default-value="${project.build.directory}/exec" * @required */ protected File execDir; public void execute() throws MojoExecutionException, MojoFailureException { + if ("bundles".equals(project.getArtifact().getType())) { + System.out.println("Skip artifact of type bundles " + + artifactToString(project.getArtifact())); + return; + } + try { Artifact equinoxArtifact = null; Artifact osgiBootArtifact = null; @@ -128,6 +135,9 @@ public class EquinoxExecMojo extends AbstractOsgiMojo { if (systemProperties == null) systemProperties = new HashMap(); + if (!execDir.exists()) + execDir.mkdirs(); + // Build command List cmdList = new ArrayList(); cmdList.add(jvm); @@ -146,6 +156,7 @@ public class EquinoxExecMojo extends AbstractOsgiMojo { if (value != null) { strValue = value.toString().trim(); strValue = strValue.replaceAll("\n", ""); + strValue = strValue.replaceAll("\t", ""); } cmdList.add("-D" + key + "=" + strValue); } @@ -155,9 +166,18 @@ public class EquinoxExecMojo extends AbstractOsgiMojo { String[] cmd = (String[]) cmdList.toArray(new String[0]); - for (int i = 0; i < cmd.length; i++) + System.out.println("\nExecute command:\n"); + for (int i = 0; i < cmd.length; i++) { + boolean containsSpace = (cmd[i].indexOf(' ') >= 0) + || (cmd[i].indexOf('\t') >= 0); + if (containsSpace) + System.out.print('\"'); System.out.print(cmd[i]); - System.out.print('\n'); + if (containsSpace) + System.out.print('\"'); + System.out.print(' '); + } + System.out.println("\n"); SystemCall systemCall = new SystemCall(execDir.getCanonicalPath(), cmd, true); @@ -170,10 +190,13 @@ public class EquinoxExecMojo extends AbstractOsgiMojo { } protected static void printArtifact(Artifact artifact) { - System.out.println(artifact.getGroupId() + ":" - + artifact.getArtifactId() + ":" + artifact.getType() + ":" - + artifact.getClassifier() + ":" + artifact.getVersion() + " (" - + artifact.getFile() + ")"); + System.out.println(artifactToString(artifact)); + } + + protected static String artifactToString(Artifact artifact) { + return artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + + artifact.getType() + ":" + artifact.getClassifier() + ":" + + artifact.getVersion() + " (" + artifact.getFile() + ")"; } } -- 2.39.2