Do you mean that you want to weave in compiled aspects to two
different modules? If so, that's certainly possible. You are not using
aspect terminology which makes it a bit difficult to understand what
you actually want to achieve. But assuming I understood you correctly,
you'd be using post-compile weaving and you could achieve this by
configuring something like:

                                <configuration>
                                        <source>1.6</source>
                                        <target>1.6</target>
                                        <showWeaveInfo>true</showWeaveInfo>
                                        <aspectLibraries>
                                                <aspectLibrary>
                                                        
<groupId>com.mycompany</groupId>
                                                        
<artifactId>myaspectlib</artifactId>
                                                </aspectLibrary>
                                        </aspectLibraries>
                                        <weaveDependencies>
                                                <weaveDependency>
                                                        
<groupId>com.mycompany</groupId>
                                                        
<artifactId>applyaspectstothislib</artifactId>
                                                </weaveDependency>
                                        </weaveDependencies>
                                </configuration>

See http://mojo.codehaus.org/aspectj-maven-plugin/weaveJars.html. You
also have the option of doing load-time weaving (see
http://www.eclipse.org/aspectj/doc/released/devguide/ltw.html). Either
way, if your IDE is Eclipse, it offers decent support for AOP
(unsurprisingly since aspectj is their project). You would need to
refactor the aspects to a separate module then configure the aspect
compiler for the two target modules and make sure that the weaved-in
classes are packaged up properly (assuming you use compile-time
weaving).

Kalle


On Tue, Jan 12, 2010 at 2:47 PM, Wendy Smoak <[email protected]> wrote:
> A project team has a set of classes that need to be instrumented two
> different ways with AspectJ, one to work within a webapp and the
> second to work standalone.
>
> The classes are kept inside the webapp module, so processing them
> during the build to produce the war works okay.
>
> What's the best way to instrument these same classes the _other_ way
> for the standalone jar?
>
> I've suggested establishing separate modules for the 'different' jars
> and possibly putting the shared code in a third module, but they say
> it's not possible, and I don't have enough experience with AspectJ to
> argue the point.  I agree it would probably complicate building in the
> IDE.
>
> At the moment they're doing it with profiles, and executing Maven
> twice to produce the different artifacts.
>
> Any suggestions?
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to