7 Replies Latest reply on Jan 17, 2011 12:47 PM by afloom

    packaging .aop using maven?

    elangovans

      Hi, I am new to AOP. I am planning to develop aspects and would like to use these aspects in web applications. What are options available? From my research and understanding (I could be wrong, so please correct me)...

       

      1) Aspects are deployed on to JBoss as .aop. Is there a Maven packaging type called AOP? Please give me some pointers, how to build .aop.

       

      2) I would have to create a *-aop.xml to define the pointcuts. Of course I can use annotations but I would like to use these aspects in multiple web applications. So I would like to use the xml file. Is that a right design?

       

      Appreciate your help.

       

      thanks

      Elangovan S

        • 1. Re: packaging .aop using maven?

          2. I'm using XML file and I think that it is the right way, because you can change pointcuts without recompilation

           

          1. I also have issues with packaging. I have to manually copy jboss-aop.xml file to the WEB-INF/classes/META-INF folder of my web application. I'm still looking for a better solution.

           

          Any ideas on (1) anyone?

          • 2. Re: packaging .aop using maven?

            Oh, I just found out that there should be hassle to copy jbss-aop.xml

            I'm just putting it into src/main/resources/META-INF/jboss-aop.xml and it gets copied into the right place during the package goal.

            Don't forget to point jboss-aop maven plugin to its location:

                                     <aoppaths>
                                            <aoppath>src/main/resources/META-INF/jboss-aop.xml</aoppath>
                                        </aoppaths>

            • 3. Re: packaging .aop using maven?
              heineson

              Hi,

               

              Regarding your first question, you can do this to get an .aop module via maven, if you put it inside an .ear:

              1) Create a standard .jar-module and put your jboss-aop.xml inside the META-INF directory.

              2) In the pom-file where you assembe the ear do like this:

              ...

                 <build>
                  <plugins>
                    <plugin>
                      <artifactId>maven-ear-plugin</artifactId>
                         ...
                        <modules>
                          <javaModule>
                            <groupId>group.id</groupId>
                            <artifactId>aop-jar</artifactId>
                            <bundleFileName>aop-jar.aop</bundleFileName>
                            <includeInApplicationXml>true</includeInApplicationXml>
                          </javaModule>

              ...

               

              The <bundleFileName> tag will package the aop-jar.jar module as aop-jar.aop in the .ear.

               

              I have only done this for .ear-modules, but you can always check if is is possible to do with the maven plugin for assembling .wars in case you want a .war archive

               

              Regards

              Jonas Heineson

              • 4. Re: packaging .aop using maven?
                afloom

                I'm working on a solution for aop packaging that would be incorporated into the JBoss Packaging Maven Plugin at Codehaus Mojo. Watch this ticket:

                http://jira.codehaus.org/browse/MJBOSSPACK-37

                 

                /Anders

                • 5. packaging .aop using maven?
                  afloom

                  v2.2 of JBoss Packaging Maven Plugin has now been released, which includes support for AOP archives.

                  http://mojo.codehaus.org/jboss-packaging-maven-plugin/

                   

                  /Anders

                  • 6. packaging .aop using maven?
                    elangovans

                    Thanks Andres for the update on this thread. Will try it out.

                     

                    Elangovan S

                    • 7. packaging .aop using maven?
                      afloom

                      Do so. Please report any issues you run into!

                       

                      /Anders