Maven,Scala,Spring,AspectJ [英] Maven, Scala, Spring, AspectJ
本文介绍了Maven,Scala,Spring,AspectJ的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人知道您是否可以在编译时使用AspectJ&编织scala类.春天.我在所有Java类上都进行了编译,但是我似乎无法使它在使用@Configurable的Scala类中正常工作.
Does anyone know if you can weave scala classes at compile time with aspectJ & spring. I have compile time weaving working for all my java classes but I can't seem to get it to work for my scala classes that use @Configurable.
推荐答案
在背景方面,我已经进行了几天的研究.真痛苦无论如何,这就是答案.是的,可以做到,您不能使用aspectj maven插件.您必须使用antrun maven插件.快乐的Scala编码!
For background I have been working on this for a couple of days. What a pain. Anyways here's the answer. Yes it can be done, you just can't use the aspectj maven plugin. You have to use the antrun maven plugin. Happy Scala Coding!
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties"
classpathref="maven.plugin.classpath" />
<iajc
srcDir="src/main/scala"
destDir="target/classes"
inpath="target/classes"
source="1.6"
aspectPath="${org.springframework:spring-aspects:jar}"
classpathRef="maven.compile.classpath"
Xlint="ignore" />
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
这篇关于Maven,Scala,Spring,AspectJ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文