]> git.argeo.org Git - gpl/argeo-slc.git/blob - maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/InstallBundlesMojo.java
Add in JVM launch of the Equinox runtime
[gpl/argeo-slc.git] / maven-argeo-osgi-plugin / src / main / java / org / argeo / slc / maven / plugins / osgi / InstallBundlesMojo.java
1 package org.argeo.slc.maven.plugins.osgi;
2
3 import java.io.File;
4 import java.util.List;
5
6 import org.apache.maven.artifact.installer.ArtifactInstallationException;
7 import org.apache.maven.artifact.installer.ArtifactInstaller;
8 import org.apache.maven.plugin.MojoExecutionException;
9 import org.apache.maven.plugin.MojoFailureException;
10
11 /**
12 * @goal install-bundles
13 * @phase install
14 * @author mbaudier
15 *
16 */
17 public class InstallBundlesMojo extends AbstractBundlesPackagerMojo {
18 /** @component */
19 private ArtifactInstaller installer;
20
21 public void execute() throws MojoExecutionException, MojoFailureException {
22 List bundlePackages = analyze(false);
23 for (int i = 0; i < bundlePackages.size(); i++) {
24 AbstractBundlesPackagerMojo.BundlePackage bundlePackage = (BundlePackage) bundlePackages
25 .get(i);
26 try {
27 installer.install(bundlePackage.getPackageFile(), bundlePackage
28 .getArtifact(), local);
29 } catch (ArtifactInstallationException e) {
30 throw new MojoExecutionException("Could not install bundle "
31 + bundlePackage.getBundleDir(), e);
32 }
33 }
34
35 // Bundles pom
36 try {
37 installer.install(bundlesPomFile(), bundlesPomArtifact(), local);
38 installer.install(new File(baseDir.getPath() + File.separator
39 + "pom.xml"), project.getArtifact(), local);
40 } catch (ArtifactInstallationException e) {
41 throw new MojoExecutionException("Could not install bundles POM", e);
42 }
43
44 }
45 }