]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/EquinoxExecMojo.java
Use execDir to choose config and data dir when not forked.
[gpl/argeo-slc.git] / maven-argeo-osgi-plugin / src / main / java / org / argeo / slc / maven / plugins / osgi / EquinoxExecMojo.java
index d218100ea0769e917a3f17287c8c9a7707d68922..acf393e769140f57dcd31484f8ed1844a135344f 100644 (file)
@@ -134,9 +134,9 @@ public class EquinoxExecMojo extends AbstractOsgiMojo {
        protected long pause;
 
        public void execute() throws MojoExecutionException, MojoFailureException {
-               if ("bundles".equals(project.getArtifact().getType())) {
-                       System.out.println("Skip artifact of type bundles "
-                                       + artifactToString(project.getArtifact()));
+               if (PACKAGING_BUNDLE.equals(project.getArtifact().getType())) {
+                       System.out.println("Skip artifact of type " + PACKAGING_BUNDLE
+                                       + " " + artifactToString(project.getArtifact()));
                        return;
                }
 
@@ -194,8 +194,14 @@ public class EquinoxExecMojo extends AbstractOsgiMojo {
        protected void execNonForked(LocationsStruct locationsStruct)
                        throws Exception {
                // Set defaults
-               if (args == null)
-                       args = defaultArgs;
+               if (args == null) {
+                       if (fork)
+                               args = defaultArgs;
+                       else
+                               args = new String[] { "-console", "-configuration",
+                                               execDir.getPath() + File.separator + "conf", "-data",
+                                               execDir.getPath() + File.separator + "data" };
+               }
 
                // if (!execDir.exists())
                // execDir.mkdirs();
@@ -205,13 +211,18 @@ public class EquinoxExecMojo extends AbstractOsgiMojo {
                List cmdList = new ArrayList();
 
                // System properties
-               if (!systemProperties.containsKey("osgi.bundles"))
+               if (!systemProperties.containsKey("osgi.bundles")) {
+                       if (locationsStruct.osgiBootArtifact == null)
+                               throw new Exception("No SLC OSGi boot bundle available.");
                        System.setProperty("osgi.bundles", locationsStruct.osgiBootArtifact
                                        .getFile().getCanonicalPath()
                                        + "@start");
+               }
+
                if (!systemProperties.containsKey("slc.osgi.locations"))
                        System.setProperty("slc.osgi.locations",
                                        locationsStruct.osgiLocations);
+
                for (Iterator keys = systemProperties.keySet().iterator(); keys
                                .hasNext();) {
                        Object key = keys.next();