4 Replies Latest reply on Jul 30, 2012 3:35 AM by maxandersen

    [m2e] [maven-bundle-plugin] Adding OSGI bundle resource to a server

    ebelanger070

      Greetings,

       

      I'm using JBoss Tools 3.3.0 (Latest version on the Eclipse Marketplace), Eclipse 3.7, Maven 2 Eclipse (M2E) and JBoss AS 7.1.1.

       

      I'm having a problem with the 'Servers' view not discovering my maven project as an OSGI resource when selecting the 'Add and Remove...' context menu option.  A normal project that was created as a Plugin Project with Eclipse will be discovered though.  So far, I know that the project nature 'org.eclipse.pde.PluginNature' is configured in the M2E generated .project file, so this doesn't seem to be the trigger for discovery.

       

      Funny thing is that if I configure the maven project to not generate the PluginNature and then convert the maven project to a Plugin Project, JBoss Tools will now discover this project.  The only problem is that this operation needs to be done each time a maven project is imported into the workspace.

       

      I also looked into adding the project to the eclipse target platform, but that doesn't seem to be it either.

       

      In brief, I am wondering what 'triggers' a workspace project to be discovered as an osgi resource for the JBoss Tools.

       

      Thank you for your time.

       

      Eric

        • 1. Re: [m2e] [maven-bundle-plugin] Adding OSGI bundle resource to a server
          ebelanger070

          I found the answer.  It seems that JBoss Tools uses the build.properties file that is created in a plugin project to build the resource.  What needs to be done is to go in the MANIFEST.MF edition view and generate a build.properties from there.  JBoss Tools will now detect the project.

          • 2. Re: [m2e] [maven-bundle-plugin] Adding OSGI bundle resource to a server
            rob.stryker

            The code we use to determine whether to turn a project into a deployable osgi feature is:

             

                 protected IModule[] createModules(IProject project) {
                      if (!WorkspaceModelManager.isBinaryProject(project) && WorkspaceModelManager.isPluginProject(project)) {
                           IModel model = PluginRegistry.findModel(project);
                           if (model != null && isValidModel(model) && hasBuildProperties((IPluginModelBase) model)) {
                                IModule module = createModule(project.getName(), project.getName(), 
                                          MODULE_TYPE, VERSION, project);
                                return new IModule[] { module };
                           }
                      }
                      return null;
                 }
            

            So yes, we require that osgi recognizes it as a plugin project *and* that it has a build properties file :)

            • 3. Re: [m2e] [maven-bundle-plugin] Adding OSGI bundle resource to a server
              jigneshmpatel

              After adding build details when I tried to deploy I got following

              aused by: java.lang.ClassNotFoundException: com.icare.rpc.registration.RegistrationActivator from [Module "deployment.registration:1.0.0.BUILD-2012-06-25" from Service Module Loader]

                        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:132) [jboss-modules.jar:1.1.1.GA]

                        at org.jboss.osgi.framework.internal.HostBundleRevision.loadClass(HostBundleRevision.java:114) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                        at org.jboss.osgi.framework.internal.AbstractBundleState.loadClass(AbstractBundleState.java:415) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                        at org.jboss.osgi.framework.internal.HostBundleState.loadClass(HostBundleState.java:151) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                        at org.jboss.osgi.framework.internal.HostBundleState.transitionToActive(HostBundleState.java:294) [jbosgi-framework-core-1.1.8.Final.jar:1.1.8.Final]

                        ... 10 more

               

              here is my build.properties file

              bin.includes = META-INF/,\

               

              After further research it seems eclipse Indio R2 doesn't recognize the target/classes location.


              • 4. Re: [m2e] [maven-bundle-plugin] Adding OSGI bundle resource to a server
                maxandersen

                jignesh, Indigo recognize target/classes location if your build.properties file and .classpath/.project files are correct and specify these as its output.