Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] load-time-weaving with maven aspectj plugin

Hi,

We use maven+aspectj, but we create the aop.xml file manually.
Here are some pointers for you (change env variables as necessary):

1. Add the aop.xml file to your project in the src/main/resources/META-INF directory.

2. Add the following plugin definition to your pom.xml file:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjtools</artifactId>
                        <version>${aspectj.version}</version>
                        <scope>compile</scope>
                    </dependency>
                </dependencies>
                <configuration>
                    <complianceLevel>1.5</complianceLevel>
                </configuration>
            </plugin>

3. For unit tests also add the following plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <argLine>-javaagent:${basedir}/../lib/aspectjweaver-${aspectj.version}.jar ${debug}</argLine>
        <systemProperties>
            <property>
                <name>aj.weaving.verbose</name>
                <value>true</value>
            </property>
        </systemProperties>
    </configuration>
</plugin>


4. Add the following dependency to your pom.xml file:

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>

4. Not part of maven, but make sure you add the following command line option to the java executable when you launch your app:

-javaagent:${lib.dir}/aspectjweaver-1.5.4.jar

5. Also make sure your jar containing your aspects are in the classpath.

- Ashley

-----aspectj-users-bounces@xxxxxxxxxxx wrote: -----

>To: aspectj-users@xxxxxxxxxxx
>From: manuel aldana <aldana@xxxxxx>
>Sent by: aspectj-users-bounces@xxxxxxxxxxx
>Date: 06/16/2008 08:57AM
>Subject: [aspectj-users] load-time-weaving with maven aspectj plugin
>
>hi,
>
>am posting to this list because most likely one of you is using maven
>
>aspectj plugin. my current problem is that enabling load-time-weaving
>
>with aspectj-plugin does not work properly. i tried out to enable 
>load-time weaving and to use the aop.xml generation capability of 
>aspectj-maven-plugin, but still following happens:
>-plugin still tries to do compile weaving
>-aop.xml does not get generated (though <outputxml>true</outputxml>
>is 
>used)
>
>so how do i achieve that load-time weaving is enabled, i.e. aop.xml
>is 
>generated (with defining certain source-aspect-libraries and 
>target-libraries) and further more compile weaving is switched off?
>
>-- 
> manuel aldana
> aldana@xxxxxx
> software-engineering blog: www.aldana-online.de
>
>_______________________________________________
>aspectj-users mailing list
>aspectj-users@xxxxxxxxxxx
>https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
---

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.


Back to the top