DependencyManager and car-maven-plugin problem

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

DependencyManager and car-maven-plugin problem

rwengr
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: DependencyManager and car-maven-plugin problem

rwengr
The answer to this post is:

For a lot of standard components, this type of error message is not fatal.  Geronimo or the car-maven-plugin can load the basics.

For your target project (e.g. custom plugin) it's a different story.

For Geronimo 3.0.1, to generate CAR packaging, the maven project that compiles your program must generate a bundle with the dependencies embedded.  During packaging, when the car-maven-plugin boots the geronimo kernel, the dependency manager will have all the info to resolve the dependencies.  It is no longer sufficient to generate a simple jar artifact.  For a basic Geronimo bean, the plugin to generate the bundle looks like this.

The packaging for the target project must be "bundle" instead of "jar"

The geronimo kernel has no access to maven repository when it processes a bundle, so the bundle has to contain everything that geronimo is not providing in its processing container (or already loaded in a previously processed bundle?).  This example is for a project that does compilation and packaging only (no test).

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.4.0</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>bundle</goal>
            </goals>
            <configuration>
              <unpackBundle>true</unpackBundle>
              <instructions>
                <Import-Package></Import-Package>
                <Export-Package>org.apache.geronimo.directory;version=9.0.2</Export-Package>
                <Private-Package></Private-Package>
                <Embed-Dependency>*</Embed-Dependency>
                <_exportContents></_exportContents>
              </instructions>
            </configuration>
          </execution>
        </executions>
        <configuration>
        </configuration>
      </plugin>

The jar file will contain the classes you compiled.  Any jars necessary for compilation should be included in their entireity in the target jar file
Reply | Threaded
Open this post in threaded view
|

Re: DependencyManager and car-maven-plugin problem

rwengr
In reply to this post by rwengr
The initial answer to this issue is on Page 32 of Pro Apache Geronimo.

The deployment plan has to declare any Geronimo Bean you want to use as a reference.

<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
  <environment>
    <moduleId>
      <groupId>org.apache.geronimo.plugins</groupId>
      <artifactId>directory</artifactId>
      <version>9.0.2</version>
      <type>car</type>
    </moduleId>
    <dependencies/>
                <hidden-classes/>
                <non-overridable-classes/>
                <private-classes/>
  </environment>
  <gbean name="ServerInfo" class="org.apache.geronimo.system.serverinfo.BasicServerInfo">
    <attribute name="useSystemProperties">true</attribute>
  </gbean>
  <gbean name="DirectoryService" class="org.apache.geronimo.directory.DirectoryGBean">
    <attribute name="configFile">var/directory/server.xml</attribute>
    <attribute name="workingDir">var/directory</attribute>
    <reference name="GeronimoServerInfo"><name>ServerInfo</name></reference>
  </gbean>
</module>

My build was missing the "ServerInfo" <gbean>.

How did this happen?  The project I checked out from svn.apache.org had this for the plan and I have not created plugins/car before.  Maybe this was OK in Geronimo 2.1 car-maven-plugin.

<module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">

    <gbean name="DirectoryService" class="org.apache.geronimo.directory.DirectoryGBean">
        <attribute name="configFile">var/directory/server.xml</attribute>
        <attribute name="workingDir">var/directory</attribute>
        <reference name="ServerInfo"><name>ServerInfo</name></reference>
    </gbean>

</module>

I was reluctant to spend much time with books on Geronimo 2.

I verified this solution on a simplified example, but it gets more interesting.  The build for this project is still throwing the same error even though I corrected my plan.  That means there is another issue in my build or my plan causing a problem.  But at least I know now how it's suppose to work.

I might publish a tutorial when I get done with this.