How to define aop.xml for the aspectJ compiler

We decided to give intellij a try and I am having trouble setting up the aspectJ compiler. 

I read through this useful tutorial but what I am missing is where do I point the compiler to the aop.xml file?

In Eclipse there is a specific window to manage it (see image), but I could not find the Intellij equivalent.

Any ideas?

 

 

 

 

We are working quiet a lot with aspects. W

 

 

 

we got the Ultimate version and 

0
Avatar
Permanently deleted user

Hi, I need this too.

I'm using Maven build and it works fine with this pom.xml:

...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<configuration>
<source>${java.source.version}</source>
<target>${java.target.version}</target>
<XnoInline>true</XnoInline>
<complianceLevel>${java.target.version}</complianceLevel>
<xmlConfigured>src/main/resources/META-INF/aop.xml</xmlConfigured>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
<verbose>true</verbose>
<showWeaveInfo>true</showWeaveInfo>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${org.aspectj.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
...

I'm using the aop.xml config to tell AspectJ CTW to exclude JpaExceptionTranslatorAspect via including only the needed ones:

<aspectj>
   <aspects>
      <aspect name="org.springframework.beans.factory.aspectj.AbstractInterfaceDrivenDependencyInjectionAspect"/>
      <aspect name="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect" />
      <aspect name="org.springframework.scheduling.aspectj.AnnotationAsyncExecutionAspect" />
      <aspect name="org.springframework.transaction.aspectj.AnnotationTransactionAspect" />
      <aspect name="org.springframework.cache.aspectj.AnnotationCacheAspect" />
   </aspects>
...

And if I build and run it inside idea it does not work because I get:

...

Information:ajc: Join point 'method-call(void javax.persistence.EntityManager.persist(java.lang.Object))' in Type 'com.mycompany.MyClass' (MyClass.java:282) advised by afterThrowing advice from 'org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect' (spring-aspects-4.3.12.RELEASE.jar!JpaExceptionTranslatorAspect.class:36(from JpaExceptionTranslatorAspect.aj))

...

But if I build it via maven like

mvn clean install it respects the aop.xml

Also If I need to debug a unit test I need to build it with maven and then debug it as a workaround.

 

Thanks

 

0

请先登录再写评论。