Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] AspectJ compile-time weaving in Maven not working

I found the problem: I was putting the AspectJ <plugin></plugin> under
<pluginManagement>. This means the AspectJ plugin was configured, but
never actually wired up. Really stupid mistake, but almost impossible
to notice. I only discovered it because I found another user post in
MarkMail from somebody who did the exact same thing.



On Mon, May 25, 2009 at 7:50 PM, Ramnivas Laddad
<ramnivas@xxxxxxxxxxxxxxx> wrote:
> Nothing jumps out from your Maven snippet. I am not a Maven expert,
> but the following snippet works for me:
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.codehaus.mojo</groupId>
>                <artifactId>aspectj-maven-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <goals>
>                            <goal>compile</goal>
>                        </goals>
>
>                        <configuration>
>                           <source>1.5</source>
>                           <target>1.5</target>
>                                    <aspectLibraries>
>                                        <aspectLibrary>
>                                                        <groupId>org.springframework</groupId>
>                                                                <artifactId>spring-aspects</artifactId>
>                                        </aspectLibrary>
>                                    </aspectLibraries>
>                       </configuration>
>                    </execution>
>                </executions>
>            </plugin>
>        </plugins>
>    </build>
>
> Give it a try.
>
> Also, how do you bootstrap Spring's application context?
>
> -Ramnivas
>
> On Sat, May 23, 2009 at 7:12 AM, Robert Campbell <rrc7cz@xxxxxxxxx> wrote:
>> Hello,
>>
>> I was using AspectJ LTW in my Spring application to inject
>> dependencies in objects never created outside the Spring bean-factory.
>> I have decided to switch to CTW, but I can't seem to get it working
>> correctly in Eclipse or Maven. For Maven, I generally followed this
>> guide: http://www.chrissearle.org/blog/technical/spring_aspects_configurable_and_compile_time_weaving_using_maven
>>
>> I added aspectjrt-1.6.4 and spring-aspects-2.5.4 as dependencies, plus:
>>
>>        <build>
>>                <pluginManagement>
>>                        <plugins>
>>                    <plugin>
>>                        <groupId>org.codehaus.mojo</groupId>
>>                        <artifactId>aspectj-maven-plugin</artifactId>
>>                        <version>1.1</version>
>>                        <configuration>
>>                                <complianceLevel>1.6</complianceLevel>
>>                                <verbose>true</verbose>
>>                            <aspectLibraries>
>>                                <aspectLibrary>
>>                                                            <groupId>org.springframework</groupId>
>>                                                            <artifactId>spring-aspects</artifactId>
>>                                </aspectLibrary>
>>                            </aspectLibraries>
>>                            <showWeaveInfo>true</showWeaveInfo>
>>                        </configuration>
>>                        <executions>
>>                            <execution>
>>                                <goals>
>>                                    <goal>compile</goal>
>>                                </goals>
>>                            </execution>
>>                       </executions>
>>                   </plugin>
>>
>> Unfortunately, my dependencies never get injected when I boot up. I
>> also didn't notice any AspectJ-specific messages during the Maven
>> compile.
>>
>> In Eclipse, I use the AspectJ plugin. I right-clicked on my existing
>> project and selected something like "Add AspectJ Capability" or
>> whatever it was. It then appeared with the little A on the icon. From
>> this point I tried building and running the projects as normal, and no
>> dependencies were injected. I then tried adding spring-aspects.jar to
>> my Aspects Path, but that didn't help either.
>>
>> Any suggestions would be very welcome.
>>
>> Rob
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>

Back to the top