views:

28

answers:

1

I am trying to convert my load-time-woven aspectj to compile-time-woven.

So I removed <context:load-time-weaver/> from my spring config, and added an aspectj compiler to my pom.xml. But I don't know how to convert the info in META-INF/aop.xml.

I have something like this in there:

<!DOCTYPE aspectj PUBLIC
        "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd"&gt;
<aspectj>
    <weaver>
        <!-- only weave classes in this package -->
    </weaver>
    <aspects>
        <!-- use only this aspect for weaving -->
        <concrete-aspect name="MyAspect_" extends="hu.myAspect">
        <pointcut name="pointcut" expression="execution(public * javax.persistence.EntityManager.*(..)) || execution(public * hu..*.create(..))"/>
        </concrete-aspect>
    </aspects>
</aspectj>
A: 

There is no exact equivalent to aop.xml in compile-time weaving, but you can configure the AspectJ maven plugin to include and exclude certain aspects like this

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.3</version>
    <configuration>
        <includes>
            <include>**/TransationAspect.java</include>
            <include>**/SecurityAspect.aj</include>
        </includes>
        <excludes>
            <exclude>**/logging/*.aj</exclude>
        </excludes>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>
seanizer
thanks for answering, but can I configure pointcuts there?
pihentagy
I don't think you can. I think you can only include / exclude entire aspects, not individual pointcuts. Maybe the ajdt build def file is an option (but I don't know): http://mojo.codehaus.org/aspectj-maven-plugin/compile-mojo.html#ajdtBuildDefFile
seanizer