karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1099720 - /karaf/trunk/manual/src/main/webapp/developers-guide/extending-console.conf
Date Thu, 05 May 2011 08:47:44 GMT
Author: jbonofre
Date: Thu May  5 08:47:43 2011
New Revision: 1099720

URL: http://svn.apache.org/viewvc?rev=1099720&view=rev
Log:
[KARAF-600] Update the "Extending Console" manual page.

Modified:
    karaf/trunk/manual/src/main/webapp/developers-guide/extending-console.conf

Modified: karaf/trunk/manual/src/main/webapp/developers-guide/extending-console.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/developers-guide/extending-console.conf?rev=1099720&r1=1099719&r2=1099720&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/developers-guide/extending-console.conf (original)
+++ karaf/trunk/manual/src/main/webapp/developers-guide/extending-console.conf Thu May  5
08:47:43 2011
@@ -43,42 +43,54 @@ h3. Manual creation
 Alternatively, you can simply create the directory {{shell-sample-commands}} and create the
{{pom.xml}} file inside it:
 
 {pygmentize:xml}
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
-                             http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
   <modelVersion>4.0.0</modelVersion>
+
   <groupId>org.apache.karaf.shell.samples</groupId>
   <artifactId>shell-sample-commands<artifactId>
-  <packaging>jar</packaging>
+  <packaging>bundle</packaging>
   <version>1.0-SNAPSHOT</version>
   <name>shell-sample-commmands</name>
-  <url>http://maven.apache.org</url>
+
+
   <dependencies>
     <dependency>
+      <groupId>org.apache.karaf.shell</groupId>
+      <artifactId>org.apache.karaf.shell.console</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.1</version>
       <scope>test</scope>
     </dependency>
   </dependencies>
-</project>
-{pygmentize}
-
-h2. Dependencies
 
-We need to tell maven which libraries our project depends on.  In the {{dependencies}} section
of the pom, add the following one:
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>${felix.plugin.version}</version>
+        <configuration>
+          <instructions>
+            <Import-Package>
+              org.apache.felix.service.command,
+              org.apache.felix.gogo.commands,
+              org.apache.karaf.shell.console,
+              *
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
 
-{pygmentize:xml}
-  <dependency>
-    <groupId>org.apache.karaf.shell</groupId>
-    <artifactId>org.apache.karaf.shell.console</artifactId>
-    <version>${project.version}</version>
-  </dependency>
+</project>
 {pygmentize}
 
-This dependency is needed to have access to the base classes that are used to define commands.
-
 h2. Configuring for Java 5
 
 We are using annotations to define commands, so we need to ensure maven will actually use
JDK 1.5 to compile the jar.
@@ -122,8 +134,6 @@ We can now create the command class {{He
 package org.apache.karaf.shell.samples;
 
 import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.gogo.commands.Option;
-import org.apache.felix.gogo.commands.Argument;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
 
 @Command(scope = "test", name = "hello", description="Says hello")
@@ -178,36 +188,6 @@ The end of the maven output should look 
 [INFO] ------------------------------------------------------------------------
 {code}
 
-h2. Turning the jar into an OSGi bundle
-
-OSGi bundles are jars but they require some manifest headers to be correctly recognized.
 We will leverage Felix's maven plugin to easily generate those.  
-
-Lets turn it into a bundle: modify the line in the {{pom.xml}} to adjust the packaging:
-
-{pygmentize:xml}
-  <packaging>bundle</packaging>
-{pygmentize}
-
-Add the following section at the bottom of the {{pom.xml}}, in the existing {{build/plugins}}
section:
-
-{pygmentize:xml}
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>2.1.0</version>
-        <extensions>true</extensions>
-        <configuration>
-            <instructions>
-                <Import-Package>org.osgi.service.command,*</Import-Package>
-            </instructions>
-        </configuration>
-      </plugin>
-{pygmentize}
-
-The {{Import-Package}} is required to make sure our bundle will import the {{org.osgi.service.command}}
package so that the service will be correctly seen in Felix.
-
-Let's compiled it again using the {{mvn install}} command.
-
 h2. Test in Karaf
 
 Launch a Karaf instance and run the following command to install the newly created bundle:
@@ -236,7 +216,6 @@ We add an argument to the HelloCommand:
 package org.apache.karaf.shell.samples;
 
 import org.apache.felix.gogo.commands.Command;
-import org.apache.felix.gogo.commands.Option;
 import org.apache.felix.gogo.commands.Argument;
 import org.apache.karaf.shell.console.OsgiCommandSupport;
 
@@ -313,7 +292,6 @@ Using Blueprint, you can "inject" the co
 
 h2. Test in Karaf
 
-
 Launch a Karaf instance and run the following command to install the newly created bundle:
 {code}
 karaf@root> osgi:install -s mvn:org.apache.karaf.shell.samples/shell-sample-commands/1.0-SNAPSHOT



Mime
View raw message