Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] woven classes not getting into the woven jar

I changed the call() pointcuts into execution() pointcuts and the woven jar now contains advised classes.

RTFM can be a very useful thing to do. Thanks again.

Jane

On Sep 23, 2010, at 5:01 PM, Andy Clement wrote:

Glad we could work out what is wrong.

If you need to weave into the targets of the calls, you could use
execution() rather than call() pointcuts.

Andy

On 23 September 2010 13:53,  <softweave@xxxxxxxxxxx> wrote:
Thanks for responding. Turning on the verbose and weaveInfo options was very
informative. It showed I had a basic misunderstanding of when/how aspects
are applied.

None of the classes that were jarred contained advice because
"Xlint:adviceDidNotMatch". The JUnit method-call join points into those
classes were advised by the around advice I wrote. I'd expected the advice
would be woven into the target methods rather than calls to the target
methods.

Oh well. At least, I now understand why the jarred classes don't perform as
I'd hoped.

Jane

----- Original Message -----
From: "Andy Clement" <andrew.clement@xxxxxxxxx>
To: aspectj-users@xxxxxxxxxxx
Sent: Thursday, September 23, 2010 4:15:04 PM
Subject: Re: [aspectj-users] woven classes not getting into the woven jar

Hi,

I had hoped an expert on the maven-aspectj plugin would dive in here,
but no luck so far...

Have you tried removing the section:

<includes>
  <include>**/*.java</include>
</includes>
<excludes>
  <exclude />
</excludes>

since java and aj files are added by default.  I'm just thinking of
that to bring it more in line with the example on:

http://mojo.codehaus.org/aspectj-maven-plugin/libraryJars.html

Does the plugin let you turn on the showWeaveInfo/verbose options so
you can see if weaving is actually occurring?

cheers,
Andy

On 20 September 2010 22:52, Jane Eisenstein <janee@xxxxxxxxxxxxx> wrote:

I created an aspect library jar and am weaving it into java classes that
go
into a woven jar. I use maven 2.2.1 and aspectj-maven-plugin 1.3 to build
the aspect library and weave it into the java classes.
Running a JUnit that tests the weaving in the the woven project, passes.
If
I copy the same JUnit test into a project that depends on the woven
project's jar and aspectjrt.jar, the JUnit test fails.
Apparently the woven classes are not getting into the "woven" jar. I would
appreciate any insights you might have into what is causing this problem.
This is the pom.xml for the woven project:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.med</groupId>
<artifactId>cdc-aop-woven</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>cdc-aop-woven</name>
<build>
<plugins>
<plugin>
<!-- This is necessary to enable JDK 1.6 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<complianceLevel>1.6</complianceLevel>
<includes>
<include>**/*.java</include>
</includes>
<excludes>
<exclude />
</excludes>
<aspectLibraries>
<aspectLibrary>
<groupId>com.med</groupId>
<artifactId>cdc-aop</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<!-- use this goal to weave all your main classes -->
<goal>compile</goal>
<!-- use this goal to weave all your test classes -->
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.9</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.med</groupId>
<artifactId>cdc-aop</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
This is the pom.xml for the project that tests the woven jar:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.med</groupId>
<artifactId>cdc-aop-woven-client</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>cdc-aop-woven-client</name>
<build>
<plugins>
<plugin>
<!-- This is necessary to enable JDK 1.6 -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.9</version>
</dependency>
<dependency>
<groupId>com.med</groupId>
<artifactId>cdc-aop-woven</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>




_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top