karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1129650 - in /karaf/trunk: manual/src/main/webapp/developers-guide/ tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/
Date Tue, 31 May 2011 12:38:49 GMT
Author: jbonofre
Date: Tue May 31 12:38:48 2011
New Revision: 1129650

URL: http://svn.apache.org/viewvc?rev=1129650&view=rev
Log:
[KARAF-651] karaf-maven-plugin validate goal now tries to embed Karaf core features (standard
and enterprise) in the repositories set.

Added:
    karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-add.conf
      - copied, changed from r1129210, karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-add.conf
    karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-generate.conf
      - copied, changed from r1129210, karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-generate.conf
    karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-validate.conf
      - copied, changed from r1129210, karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-validate.conf
    karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin.conf
Removed:
    karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-add.conf
    karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-generate.conf
    karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-validate.conf
    karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin.conf
Modified:
    karaf/trunk/manual/src/main/webapp/developers-guide/index.conf
    karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java

Modified: karaf/trunk/manual/src/main/webapp/developers-guide/index.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/index.conf?rev=1129650&r1=1129649&r2=1129650&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/index.conf (original)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/index.conf Tue May 31 12:38:48 2011
@@ -4,7 +4,7 @@ h1. Developers Guide
 * [Extending the Console|extending-console]
 * [Custom Distribution|custom-distribution]
 * [Security Framework|security-framework]
-* [Using the features-maven-plugin|features-maven-plugin]
+* [Using the karaf-maven-plugin|karaf-maven-plugin]
 * [Troubleshooting, Debugging, Profiling, and Monitoring|debugging]
 * [Developer commands|developer-commands]
 * [Programmatically connect to the console|connect-console]

Copied: karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-add.conf (from
r1129210, karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-add.conf)
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-add.conf?p2=karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-add.conf&p1=karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-add.conf&r1=1129210&r2=1129650&rev=1129650&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-add.conf (original)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-add.conf Tue May
31 12:38:48 2011
@@ -1,6 +1,6 @@
-h2. Goal {{features:add-features-to-repo}}
+h2. Goal {{karaf:add-features-to-repo}}
 
-The {{features:add-features-to-repo}} goal adds all the required bundles for a given set
of features into directory.  You can use this goal to create a {{/system}} directory for building
your own Karaf-based distribution.
+The {{karaf:add-features-to-repo}} goal adds all the required bundles for a given set of
features into directory.  You can use this goal to create a {{/system}} directory for building
your own Karaf-based distribution.
 
 h3. Example
 The example below copies the bundles for the {{spring}} and {{war}} features defined in the
Karaf features XML descriptor into the {{target/features-repo}} directory.
@@ -10,7 +10,7 @@ The example below copies the bundles for
     <plugins>
       <plugin>
         <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>features-maven-plugin</artifactId>
+        <artifactId>karaf-maven-plugin</artifactId>
         <version>${project.version}</version>
 
         <executions>
@@ -34,7 +34,7 @@ The example below copies the bundles for
         </executions>
       </plugin>
     </plugins>
-  </build>  
+  </build>
 </project>
 {pygmentize}
 

Copied: karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-generate.conf
(from r1129210, karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-generate.conf)
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-generate.conf?p2=karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-generate.conf&p1=karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-generate.conf&r1=1129210&r2=1129650&rev=1129650&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-generate.conf
(original)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-generate.conf Tue
May 31 12:38:48 2011
@@ -1,6 +1,6 @@
-h2. Goal {{features:generate}}
+h2. Goal {{karaf:generate}}
 
-The {{features:generate}} goal generates a features XML file for every bundle listed in the
project's dependencies.  In order to satisfy the required imports in these bundles, the plugin
will add bundles:
+The {{karaf:generate}} goal generates a features XML file for every bundle listed in the
project's dependencies.  In order to satisfy the required imports in these bundles, the plugin
will add bundles:
 - bundles provided by Apache Karaf
 - a list of bundles
 - bundles discovered in the POM's transitive dependencies
@@ -8,7 +8,7 @@ The {{features:generate}} goal generates
 Afterwards, the generated file is attached to the build as an additional build artifact (by
default as {{group:artifact:version:xml:features}})
 
 h3. Example
-The example below generates one feature that installs bundle {{mvn:org.apache:bundle1:1.0}}
in a features XML file called {{target/features.xml}}.  It will find bundle in Apache Karaf
${project.version}, the transitive dependencies for this POM and the bundles listed in {{src/main/resources/bundles.properties}}.

+The example below generates one feature that installs bundle {{mvn:org.apache:bundle1:1.0}}
in a features XML file called {{target/features.xml}}.  It will find bundle in Apache Karaf
${project.version}, the transitive dependencies for this POM and the bundles listed in {{src/main/resources/bundles.properties}}.
 {pygmentize:xml}
 <project>
   <dependencies>
@@ -22,7 +22,7 @@ The example below generates one feature 
     <plugins>
       <plugin>
         <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>features-maven-plugin</artifactId>
+        <artifactId>karaf-maven-plugin</artifactId>
         <version>${project.version}</version>
           <executions>
             <execution>
@@ -40,7 +40,7 @@ The example below generates one feature 
           </executions>
         </plugin>
     </plugins>
-  </build>  
+  </build>
 </project>
 {pygmentize}
 

Copied: karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-validate.conf
(from r1129210, karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-validate.conf)
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-validate.conf?p2=karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-validate.conf&p1=karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-validate.conf&r1=1129210&r2=1129650&rev=1129650&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/features-maven-plugin-validate.conf
(original)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin-validate.conf Tue
May 31 12:38:48 2011
@@ -1,6 +1,9 @@
-h2. Goal {{features:validate}}
+h2. Goal {{karaf:validate}}
 
-The {{features:validate}} goal validates a features XML descriptor by checking if all the
required imports for the bundles defined in the features can be matched to a provided export.
+The {{karaf:validate}} goal validates a features XML descriptor by checking if all the required
imports for the bundles defined in the features can be matched to a provided export.
+
+By default, the plugin tries to add the Karaf core features (standard and enterprise) in
the repositories set.
+It means that it's not required to explicitly define the Karaf features descriptor in the
repository section of your features descriptor.
 
 h3. Example
 The example below validates the features defined in the {{target/features.xml}} by checking
all the imports and exports.  It reads the definition for the packages that are exported by
the system bundle from the {{src/main/resources/config.properties}} file.
@@ -10,7 +13,7 @@ The example below validates the features
     <plugins>
       <plugin>
         <groupId>org.apache.karaf.tooling</groupId>
-        <artifactId>features-maven-plugin</artifactId>
+        <artifactId>karaf-maven-plugin</artifactId>
         <version>${project.version}</version>
           <executions>
             <execution>
@@ -34,7 +37,7 @@ The example below validates the features
           </dependencies>
         </plugin>
     </plugins>
-  </build>  
+  </build>
 </project>
 {pygmentize}
 
@@ -43,4 +46,5 @@ h3. Parameters
 | {{file}} | {{File}} | The features XML descriptor file to validate. \\ Default value: {{${project.build.directory}/classes/features.xml}}
|
 | {{karafConfig}} | {{String}} | The Karaf {{config.properties}} file to use during the validation
process \\ Default value: {{config.properties}} |
 | {{jreVersion}} | {{String}} | The JRE version that is used during the validation process
\\ Default value: {{jre-1.5}) |
+| {{karafVersion}} | {{String}} | The target Karaf version used to get the Karaf core features
(standard and enterprise) \\ Default is the version of the plugin |
 | {{repositories}} | {{String[]}} | Additional features XML descriptors that will be used
during the validation process |
\ No newline at end of file

Added: karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin.conf?rev=1129650&view=auto
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin.conf (added)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/karaf-maven-plugin.conf Tue May 31
12:38:48 2011
@@ -0,0 +1,21 @@
+h1. Using the karaf-maven-plugin
+
+The Karaf maven plugin allows you:
+
+    * to manipulate Karaf features: validate a features descriptor, add features bundle into
a repository, create a KAR archive from a features descriptor, etc.
+    * to manipulate Karaf commands help: it generates help from Karaf commands
+    * to manipulate Karaf instance and create distribution
+
+h2. Features goals
+
+The {{karaf-maven-plugin}} provides several goals to help you create and validate features
XML descriptors as well as leverage your features to create a custom Karaf distribution.
+
+|| Goal || Description ||
+| {{[karaf:add-features-to-repo|karaf-maven-plugin-add]}} | Copies all the bundles required
for a given set of features into a directory \\ (e.g. for creating your own Karaf-based distribution)
|
+| {{[karaf:generate-features-xml|karaf-maven-plugin-generate]}} | Generates a features XML
descriptor for a set of bundles |
+| {{[karaf:validate|karaf-maven-plugin-validate]}} | Validate a features XML descriptor by
checking if all the required imports can be matched to exports |
+
+
+h2. Commands help goals
+
+h2. Instances and distributions goals
\ No newline at end of file

Modified: karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java
URL: http://svn.apache.org/viewvc/karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java?rev=1129650&r1=1129649&r2=1129650&view=diff
==============================================================================
--- karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java
(original)
+++ karaf/trunk/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/ValidateFeaturesMojo.java
Tue May 31 12:38:48 2011
@@ -26,13 +26,7 @@ import java.io.InputStream;
 import java.io.PrintStream;
 import java.net.URI;
 import java.net.URL;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;
 import java.util.jar.JarInputStream;
 import java.util.jar.Manifest;
 import java.util.zip.ZipException;
@@ -79,6 +73,9 @@ public class ValidateFeaturesMojo extend
     private static final String MVN_URI_PREFIX = "mvn:";
     private static final String MVN_REPO_SEPARATOR = "!";
 
+    private static final String KARAF_CORE_STANDARD_FEATURE_URL = "mvn:org.apache.karaf.assemblies.features/standard/%s/xml/features";
+    private static final String KARAF_CORE_ENTERPRISE_FEATURE_URL = "mvn:org.apache.karaf.assemblies.features/enterprise/%s/xml/features";
+
     /**
      * The dependency tree builder to use.
      *
@@ -119,6 +116,13 @@ public class ValidateFeaturesMojo extend
     private String jreVersion;
 
     /**
+     * which karaf version used for karaf core features resolution
+     *
+     * @parameter
+     */
+    private String karafVersion;
+
+    /**
      *  The repositories which are included from the plugin config   
      *  @parameter 
      */
@@ -198,6 +202,38 @@ public class ValidateFeaturesMojo extend
         readSystemPackages();
         info(" - getting list of provided bundle exports");
         readProvidedBundles();
+        info(" - populating repositories with karaf core features descriptors");
+        appendKarafCoreFeaturesDescriptors();
+    }
+
+    /**
+     * Add Karaf core features URL in the default repositories set
+     */
+    private void appendKarafCoreFeaturesDescriptors() {
+        if (repositories == null) {
+            repositories = new ArrayList<String>();
+        }
+        if (karafVersion == null) {
+            Package p = Package.getPackage("org.apache.karaf.tooling");
+            karafVersion = p.getImplementationVersion();
+        }
+        String karafCoreStandardFeaturesUrl = String.format(KARAF_CORE_STANDARD_FEATURE_URL,
karafVersion);
+        String karafCoreEnterpriseFeaturesUrl = String.format(KARAF_CORE_ENTERPRISE_FEATURE_URL,
karafVersion);
+
+        try {
+            resolve(karafCoreStandardFeaturesUrl);
+            repositories.add(karafCoreStandardFeaturesUrl);
+        } catch (Exception e) {
+            warn("Can't add " + karafCoreStandardFeaturesUrl + " in the default repositories
set");
+        }
+
+        try {
+            resolve(karafCoreEnterpriseFeaturesUrl);
+            repositories.add(karafCoreEnterpriseFeaturesUrl);
+        } catch (Exception e) {
+            warn("Can't add " + karafCoreStandardFeaturesUrl + " in the default repositories
set");
+        }
+
     }
 
     /*



Mime
View raw message