You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by dj...@apache.org on 2011/01/28 20:34:58 UTC

svn commit: r1064826 - /karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java

Author: djencks
Date: Fri Jan 28 19:34:58 2011
New Revision: 1064826

URL: http://svn.apache.org/viewvc?rev=1064826&view=rev
Log:
KARAF-424 include the generated feature.xml file and any resources such as legal files

Modified:
    karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java

Modified: karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java?rev=1064826&r1=1064825&r2=1064826&view=diff
==============================================================================
--- karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java (original)
+++ karaf/trunk/tooling/features-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ArchiveKarMojo.java Fri Jan 28 19:34:58 2011
@@ -33,6 +33,7 @@ import org.apache.karaf.features.interna
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.archiver.MavenArchiver;
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.codehaus.plexus.archiver.ArchiverException;
@@ -200,6 +201,10 @@ public class ArchiveKarMojo extends Mojo
 
         try {
 
+            //include the feature.xml
+
+            jarArchiver.addFile(featuresFile, "feature.xml");
+
             for (Artifact artifact: bundles) {
                 resolver.resolve(artifact, remoteRepos, localRepo);
                 File localFile = artifact.getFile();
@@ -221,6 +226,13 @@ public class ArchiveKarMojo extends Mojo
                 archiver.getArchiver().addDirectory(resourcesDir);
             }
 
+            for (Resource resource: (List<Resource>)project.getResources()) {
+                File resourceDir = new File(resource.getDirectory());
+                if (resourceDir.exists()) {
+                    jarArchiver.addDirectory(resourceDir, resource.getTargetPath());
+                }
+            }
+
             //
             // HACK: Include legal files here for sanity
             //
@@ -228,17 +240,17 @@ public class ArchiveKarMojo extends Mojo
             //
             // NOTE: Would be nice to share this with the copy-legal-files mojo
             //
-            String[] includes = {
-                    "LICENSE.txt",
-                    "LICENSE",
-
-                    "NOTICE.txt",
-                    "NOTICE",
-                    "DISCLAIMER.txt",
-                    "DISCLAIMER"
-            };
-
-            archiver.getArchiver().addDirectory(baseDirectory, "META-INF/", includes, new String[0]);
+//            String[] includes = {
+//                    "LICENSE.txt",
+//                    "LICENSE",
+//
+//                    "NOTICE.txt",
+//                    "NOTICE",
+//                    "DISCLAIMER.txt",
+//                    "DISCLAIMER"
+//            };
+//
+//            archiver.getArchiver().addDirectory(baseDirectory, "META-INF/", includes, new String[0]);
 
             //For no plan car, do nothing
 //            if (artifactDirectory.exists()) {