Maven+AspectJ

Hi,

 

I faced a problem using using AspectJ compiler Maven Plugin.  After hours of googling I didn't manage to make it work for my aspects, however my AJDT eclipse pluging compiles and works with aspects perfectly.

 

While running maven i get such warning:

[WARNING] advice defined in test.package.MyTest$TestAspects has not been applied [Xlint:adviceDidNotMatch]

 

pom.xml:

<plugins>
***
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.2</version>
                <configuration>
                    <source>1.6</source>
                    <complianceLevel>1.6</complianceLevel>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                </dependencies>
            </plugin>
***
        </plugins>
    </build>
    <dependencies>
***
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
            <version>1.6.5</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.5</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>

***
    </dependencies>

 

Aspect:

@Aspect
    static class TestAspects{

        @Pointcut("call(String some.package.PropertyProvider.getStringProperty())")
        public void interceptStringProperty(){}
   
        @Around("interceptStringProperty()")
        public String interceptConstructorForStringProperty()
        {
           return "Intercepted String Property";
        }
    }

 

Can anybody help me?

 

Thanks.

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com