<relativePath>..</relativePath>\r
</parent>\r
<artifactId>maven-argeo-osgi-plugin</artifactId>\r
- <version>0.1.10</version>\r
+ <version>0.1.11</version>\r
<packaging>maven-plugin</packaging>\r
<name>Argeo OSGi Plugin</name>\r
\r
*/
protected boolean strictManifestVersion;
+ /**
+ * Whether the manifest should be updated with the release version.
+ *
+ * @parameter expression="${updateManifestWhenReleasing}"
+ * default-value="true"
+ * @required
+ */
+ protected boolean updateManifestWhenReleasing;
+
/**
* Whether should fail if symbolic name does not match artifact id.
*
} else {
versionMain = project.getVersion();
// buildId = "R_" + sdf.format(new Date());// R for release
- buildId = "";
+ buildId = "R" + sdf.format(new Date());
}
if (!versionMain.equals(versionMfMain)) {
pom.append("\t<artifactId>" + artifactId + "</artifactId>\n");
pom.append("\t<packaging>" + packaging + "</packaging>\n");
return pom;
-
+
// TODO: use the Model object e.g.: (from install plugin)
-// Model model = new Model();
-// model.setModelVersion( "4.0.0" );
-// model.setGroupId( groupId );
-// model.setArtifactId( artifactId );
-// model.setVersion( version );
-// model.setPackaging( packaging );
-// model.setDescription( "POM was created from install:install-file" );
-// fw = new FileWriter( tempFile );
-// tempFile.deleteOnExit();
-// new MavenXpp3Writer().write( fw, model );
-// ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, tempFile );
-// artifact.addMetadata( metadata );
+ // Model model = new Model();
+ // model.setModelVersion( "4.0.0" );
+ // model.setGroupId( groupId );
+ // model.setArtifactId( artifactId );
+ // model.setVersion( version );
+ // model.setPackaging( packaging );
+ // model.setDescription( "POM was created from install:install-file" );
+ // fw = new FileWriter( tempFile );
+ // tempFile.deleteOnExit();
+ // new MavenXpp3Writer().write( fw, model );
+ // ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact,
+ // tempFile );
+ // artifact.addMetadata( metadata );
}
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();
import java.util.jar.Attributes;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.codehaus.plexus.archiver.jar.JarArchiver;
String[] excludes = { "**/.svn", "**/.svn/**" };
fileSet.setIncludes(includes);
fileSet.setExcludes(excludes);
+
+ FileOutputStream manifestOut = null;
try {
File manifestFile = bundlePackage.getManifestFile();
jarArchiver.addFileSet(fileSet);
// Write manifest
- FileOutputStream out = new FileOutputStream(manifestFile);
+ manifestOut = new FileOutputStream(manifestFile);
System.out.println("\n# BUNDLE "
+ bundlePackage.getArtifact().getArtifactId());
System.out.println(key + ": " + value);
}
- bundlePackage.getManifest().write(out);
- out.close();
- jarArchiver.setManifest(manifestFile);
+ bundlePackage.getManifest().write(manifestOut);
+ // Write jar
+ jarArchiver.setManifest(manifestFile);
jarArchiver.createArchive();
} catch (Exception e) {
throw new MojoExecutionException("Could not package bundle "
+ bundlePackage.getBundleDir(), e);
+ }finally{
+ IOUtils.closeQuietly(manifestOut);
}
// Write bundle POM