0 Replies Latest reply on Apr 9, 2009 4:21 PM by kenzotomita

    Problems with Maven plugin for multi-dependency projects

    kenzotomita

      I have tested my module in a simple Maven environment and everything works, but I have a problem when I try to integrate the jboss aop module into a multi-module Maven project.

      The most important parts of the Maven module structure:

      server
      |__ server_allcommunication (This module that contains the main method)
      |__ server_common (The module that uses the aop module)
      |__ server_rmi
      |__ server_tbac (The Jboss AOP Module)
      |__ server_xml

      The aop module is added as a dependency to the pom file of server_common. This enables server_common to use the annotations defined in the aop module. I have also added in this pom file the necessary configuration for weaving the aop module with the server_common module.

       <plugin>
       <groupId>org.jboss.maven.plugins</groupId>
       <artifactId>maven-jbossaop-plugin</artifactId>
       <version>1.0.0.GA</version>
       <executions>
       <execution>
       <id>compile</id>
       <configuration>
       <verbose>true</verbose>
       <includeProjectDependency>true</includeProjectDependency>
       <aoppaths>
       <aoppath>src/main/resources/org/cspoker/server/tbac/jboss-aop_tbac.xml</aoppath>
       </aoppaths>
       </configuration>
       <goals>
       <goal>compile</goal>
       </goals>
       </execution>
       </executions>
       </plugin>
      


      The main method is in server_allcommunication and uses server_common as a dependency. For running this main method I have configured its pom file as follow:

       <plugin>
       <groupId>org.jboss.maven.plugins</groupId>
       <artifactId>maven-jbossaop-plugin</artifactId>
       <version>1.0.0.GA</version>
       <executions>
       <execution>
       <id>run</id>
       <configuration>
       <includeProjectDependency>true</includeProjectDependency>
       <aoppaths>
       <aoppath>src/main/resources/org/cspoker/server/tbac/jboss-aop_tbac.xml</aoppath>
       </aoppaths>
       <executable>org.cspoker.server.allcommunication.RunCSPoker</executable>
       </configuration>
       <goals>
       <goal>run</goal>
       </goals>
       </execution>
       </executions>
       </plugin>
      


      But when running the application, I receive the following error from the jboss aop plugin:

      [INFO] [jbossaop:run]
      [ERROR] Exception in thread "main" java.lang.NoClassDefFoundError: org/cspoker/server/common/CSPokerServerImpl
      [ERROR] at org.cspoker.server.allcommunication.RunCSPoker.<init>(RunCSPoker.java:69)
      [ERROR] at org.cspoker.server.allcommunication.RunCSPoker.<init>(RunCSPoker.java:57)
      [ERROR] at org.cspoker.server.allcommunication.RunCSPoker.main(RunCSPoker.java:46)
      [ERROR] Caused by: java.lang.ClassNotFoundException: org.cspoker.server.common.CSPokerServerImpl
      [ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      [ERROR] at java.security.AccessController.doPrivileged(Native Method)
      [ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
      [ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
      [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      [ERROR] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
      


      org.cspoker.server.common.CSPokerServerImpl is in the server_common module which is implicitly added to server_allcommunication (has as dependencies server_xml and server_rmi which have server_common as dependency).

      Am I doing something wrong or is it a problem with the JBoss AOP Maven plugin? Is there an easier way to add aop libraries as a dependency to an other Maven module?