Prepare releasing
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 4 Jun 2009 15:41:25 +0000 (15:41 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 4 Jun 2009 15:41:25 +0000 (15:41 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2462 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

maven/maven-argeo-osgi-plugin/pom.xml
maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/AbstractBundlesPackagerMojo.java
maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/EquinoxExecMojo.java
maven/maven-argeo-osgi-plugin/src/main/java/org/argeo/slc/maven/plugins/osgi/PackageBundlesMojo.java

index a4a8db4d63476ee24866cc6144cee611d5fa3977..137de4b62ecfaa4d3ebd1efee35545291b328979 100644 (file)
@@ -7,7 +7,7 @@
                <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
index 53f686099bce229a4b6b3087b90dc48964fd7062..ee3cd28a3168dd259ca02586c04a4c4ccf32b838 100644 (file)
@@ -61,6 +61,15 @@ public abstract class AbstractBundlesPackagerMojo extends AbstractOsgiMojo {
         */
        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.
         * 
@@ -146,7 +155,7 @@ public abstract class AbstractBundlesPackagerMojo extends AbstractOsgiMojo {
                } else {
                        versionMain = project.getVersion();
                        // buildId = "R_" + sdf.format(new Date());// R for release
-                       buildId = "";
+                       buildId = "R" + sdf.format(new Date());
                }
 
                if (!versionMain.equals(versionMfMain)) {
@@ -220,20 +229,21 @@ public abstract class AbstractBundlesPackagerMojo extends AbstractOsgiMojo {
                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 );
 
        }
 
index d218100ea0769e917a3f17287c8c9a7707d68922..ef849a5d6e1a7132cfd9e2dad2dc01b815675411 100644 (file)
@@ -205,13 +205,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();
index 46598ead67e944e9d35ebb0ba536eb3cfe1dacf6..80074cb2e51d4ea81be9570c26ceebeb268e94c7 100644 (file)
@@ -9,6 +9,7 @@ import java.util.List;
 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;
@@ -44,12 +45,14 @@ public class PackageBundlesMojo extends AbstractBundlesPackagerMojo {
                        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());
@@ -61,14 +64,16 @@ public class PackageBundlesMojo extends AbstractBundlesPackagerMojo {
                                        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