Errors while switching from load time weaving to compile time weaving using aspectj

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Errors while switching from load time weaving to compile time weaving using aspectj

Bhuvan Rawal
Hi,

Im trying to switch to aspectj compiler for our project which takes a lot of time to weave during load time, so i thought of evaluating compile time weaving using aspectj. Below are the steps I took:

1. Added aspectjweaver to pom- latest stable version
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.10</version>
</dependency>
2. Added aspectj maven plugin to build
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<source>1.8</source>
<target>1.8</target>
<Xlint>ignore</Xlint>
<complianceLevel>1.8</complianceLevel>
<encoding>UTF-8</encoding>
<verbose>true</verbose>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
3. Enabled Aspectj mode in JpaRepository
@EnableTransactionManagement(mode= AdviceMode.ASPECTJ)
Now when im compiling my project Im getting some aspectj errors :

-> The parameter (parameter name) is not bound in [all branches of] pointcut
-> use of ProceedingJoinPoint is allowed only on around advice 
For the 2nd error , Ive verified, the advice is around not sure why this error occurs then.

It works perfectly fine when I was using default Spring AOP load time weaving. I tried finding my way out but could not hence posting here. (Saw this blog which lists similar thing but it says it was fixed in version 1.7.2)

I tried doing the same using ajc plugin for my ide (previous observations were using maven command line build). Similar errors occurred.

Any help would be appreciated!

Thanks,
Bhuvan


_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Errors while switching from load time weaving to compile time weaving using aspectj

Andy Clement
I’ll prefix this with I’m no maven expert :)  

You don’t seem to be specifying the version of the AspectJ compiler to use so I wonder if it is defaulting to a lower version. On here:


see where aspectjtools dependency version is set in the plugin config.  (aspectjtools is compiler+weaver+runtime  - aspectjweaver is weaver+runtime - aspectjrt is just the runtime)

cheers,
Andy


On Jul 17, 2017, at 7:25 AM, Bhuvan Rawal <[hidden email]> wrote:

Hi,

Im trying to switch to aspectj compiler for our project which takes a lot of time to weave during load time, so i thought of evaluating compile time weaving using aspectj. Below are the steps I took:

1. Added aspectjweaver to pom- latest stable version
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.10</version>
</dependency>
2. Added aspectj maven plugin to build
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.10</version>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<source>1.8</source>
<target>1.8</target>
<Xlint>ignore</Xlint>
<complianceLevel>1.8</complianceLevel>
<encoding>UTF-8</encoding>
<verbose>true</verbose>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
3. Enabled Aspectj mode in JpaRepository
@EnableTransactionManagement(mode= AdviceMode.ASPECTJ)
Now when im compiling my project Im getting some aspectj errors :

-> The parameter (parameter name) is not bound in [all branches of] pointcut
-> use of ProceedingJoinPoint is allowed only on around advice 
For the 2nd error , Ive verified, the advice is around not sure why this error occurs then.

It works perfectly fine when I was using default Spring AOP load time weaving. I tried finding my way out but could not hence posting here. (Saw this blog which lists similar thing but it says it was fixed in version 1.7.2)

I tried doing the same using ajc plugin for my ide (previous observations were using maven command line build). Similar errors occurred.

Any help would be appreciated!

Thanks,
Bhuvan

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Loading...