Bug 657754 - plugins in OSGI
plugins in OSGI
Status: CLOSED WONTFIX
Product: RHQ Project
Classification: Other
Component: Plugins (Show other bugs)
3.0.1
Unspecified Unspecified
low Severity medium (vote)
: ---
: ---
Assigned To: Simeon Pinder
Mike Foley
:
Depends On:
Blocks: 731823
  Show dependency treegraph
 
Reported: 2010-11-27 12:28 EST by Luca Stancapiano
Modified: 2014-06-30 16:34 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-30 16:34:22 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Luca Stancapiano 2010-11-27 12:28:17 EST
could be useful install the plugin jar as OSGI bundles, so we can install them in a OSGI repository. To do it we need to add some parameters in the MANIFEST.MF. maven-bundle-plugin does it in a transparent manner. I tried it in pluginAnnotations project and it works. Here I submit the updated pom.xml:


<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.rhq.helpers</groupId>
		<artifactId>rhq-helpers</artifactId>
		<version>4.0.0-SNAPSHOT</version>
	</parent>


	<groupId>org.rhq.helpers</groupId>
	<artifactId>rhq-pluginAnnotations</artifactId>
	<packaging>bundle</packaging>

	<name>RHQ plugin annotations</name>
	<description>Annotations to help generate plugin descriptors</description>
	<version>4.0.0-SNAPSHOT</version>

	<scm>
		<connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/helpers/pluginGen</connection>
		<developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/helpers/pluginGen</developerConnection>
	</scm>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.5</source>
					<target>1.5</target>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.2</version>
				<configuration>
					<archive>
						<manifest>
							<packageName>org.rhq.helpers.pluginAnnotations</packageName>
						</manifest>
					</archive>
				</configuration>
			</plugin>
			<!-- It configures the package to use inside a OSGI repository -->
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.1.0</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-DocURL>http://www.rhq-project.org/</Bundle-DocURL>
						<Export-Package>
							${project.groupId}.*;version=${project.version};-split-package:=error
                        </Export-Package>
					</instructions>
				</configuration>
			</plugin>

		</plugins>

	</build>

</project>






the only things done are moving the packaging type from 'jar' to 'bundle' (it is mandatory) and add the plugin definition
Comment 1 Heiko W. Rupp 2011-06-14 04:26:36 EDT
Ian, can you please look into this?
Comment 2 Ian Springer 2011-08-02 13:22:11 EDT
Hi Luca,

A couple questions for you:

1) Can you elaborate on your use case? That is, if the RHQ jars were in an OSGI repository, how would you take advantage of that? 
2) Which jars are you requesting this be done for?
  a) the pluginGen and pluginAnnotations jars
  b) all of the RHQ plugins in RHQ git
  c) all of the above
  d) other

Note, one negative of changing the packaging from 'jar' to 'bundle' is that we would have to update all other poms that have dependencies on the bundle jars and add <type>bundle</type> to those dependencies.
Comment 3 Luca Stancapiano 2011-08-03 15:24:29 EDT
Hi Ian,

1) RHQ pluginAnnotations is actually a main dependency for Infinispan project. An OSGI bundle, to work correctly need all dependencies installed too in a OSGI repository.  I'm sure RHQ too 'ld find advantages on this technology , being OSGI a deployment system for java applications going to spread fastly. More, the migration from a simple jar to a OSGI bundle is transparent because there are only extra keys in the MANIFEST.MF

2) Request for infinispan is only for pluginAnnotation, but the maven bundle plugin could be used by all RHQ packages simply moving the plugin configuration from the pluginAnnotation project to the rhq parent project. I've done a test and I've seen all bundles are created except for some packages that need installed databases that I ignore 

I have a new configuration where you don't need more the <type> is changed. You can try simply adding this new configuration maintainig <type>jar</type>:


      <!-- Adding OSGI metadata to the JAR without changing the packaging type. -->
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
            <archive>
                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.1.0</version>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Bundle-DocURL>http://www.rhq-project.org/</Bundle-DocURL>
                <Export-Package>
                    ${project.groupId}.*;version=${project.version};-split-package:=error
                </Export-Package>
            </instructions>
        </configuration>
        <executions>
            <execution>
                <id>bundle-manifest</id>
                <phase>process-classes</phase>
                <goals>
                    <goal>manifest</goal>
                </goals>
            </execution>
        </executions>
      </plugin>
Comment 4 Luca Stancapiano 2011-09-20 10:54:46 EDT
Are there news?
Comment 6 Jay Shaughnessy 2014-06-30 16:34:22 EDT
Closing due to inactivity

Note You need to log in before you can comment on or make changes to this bug.