- Artifact equinoxArtifact = null;
- Artifact osgiBootArtifact = null;
-
- Set dependencies = mavenDependencyManager
- .getTransitiveProjectDependencies(project, remoteRepos,
- local);
-
- StringBuffer osgiLocations = new StringBuffer();
- List bundleArtifacts = new ArrayList();
- boolean first = true;
- for (Iterator it = dependencies.iterator(); it.hasNext();) {
- Artifact depArtifact = (Artifact) it.next();
- printArtifact(depArtifact);
-
- if (depArtifact.getArtifactId().equals(equinoxArtifactId)) {
- equinoxArtifact = depArtifact;
- } else if (depArtifact.getArtifactId().equals(
- osgiBootArtifactId)) {
- osgiBootArtifact = depArtifact;
- } else {
- bundleArtifacts.add(depArtifact);
-
- if ("jar".equals(depArtifact.getType())) {
- // Add to OSGi locations
- if (first)
- first = false;
- else
- osgiLocations.append(File.pathSeparatorChar);
-
- osgiLocations.append(depArtifact.getFile()
- .getCanonicalPath().replace(File.separatorChar,
- '/'));
- }
+ LocationsStruct locationsStruct = listOsgiLocations();
+ if (fork)
+ execForked(locationsStruct);
+ else
+ execNonForked(locationsStruct);
+ } catch (Exception e) {
+ throw new MojoExecutionException("Cannot execute OSGi runtime", e);
+ } finally {
+ System.setProperty("user.dir", originalUserDir);
+ }
+ }
+
+ protected LocationsStruct listOsgiLocations() throws Exception {
+ LocationsStruct locationsStruct = new LocationsStruct();
+
+ Set dependencies = mavenDependencyManager
+ .getTransitiveProjectDependencies(project, remoteRepos, local);
+
+ StringBuffer osgiLocations = new StringBuffer();
+ List bundleArtifacts = new ArrayList();
+ boolean first = true;
+ for (Iterator it = dependencies.iterator(); it.hasNext();) {
+ Artifact depArtifact = (Artifact) it.next();
+ printArtifact(depArtifact);
+
+ if (depArtifact.getArtifactId().equals(equinoxArtifactId)) {
+ locationsStruct.equinoxArtifact = depArtifact;
+ } else if (depArtifact.getArtifactId().equals(osgiBootArtifactId)) {
+ locationsStruct.osgiBootArtifact = depArtifact;
+ } else {
+ bundleArtifacts.add(depArtifact);
+
+ if ("jar".equals(depArtifact.getType())) {
+ // Add to OSGi locations
+ if (first)
+ first = false;
+ else
+ osgiLocations.append(File.pathSeparatorChar);
+
+ osgiLocations.append(depArtifact.getFile()
+ .getCanonicalPath()
+ .replace(File.separatorChar, '/'));