Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Re: Question about Compile Time Weaving, OSGI, Java Web Start, and code duplication

What I did that work:

1. Create an aspects bundle which contains the duplicate code.  I compile the code with the aspectj-maven-plugin.
     <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>

2. In the client bundle, add the aspect bundle as an dependency.  When you compile your project, specify this aspect bundle.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>yourGroupId</groupId>
<artifactId>yourAspectBundle</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
</plugin>


Back to the top