Question

I build our multi-project application with Maven(lots of pom.xml-s). We recently introduced AspectJ, however I suspect AspectJ contributes to performance problems. In order to be sure, I'd like to build the application this time without AspectJ and see how it performs. But I would not really like to remove all AspectJ related stuff from pom.xml, so it would be handy if there was some kind of flag or something that could exclude AspectJ from build. Is there any?
Update: this does not seem to have any effect: -Dmaven.aspectj.skip=true

Was it helpful?

Solution

If you want to disable the aspectj-maven-plugin temporarily, you could add a profile to the parent pom.xml which deregisters the executions of the plugin (by assigning them to phase none). Could look like this (add your own execution IDs if you have some):

<profile>
    <id>noAspectJ</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>test-compile</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>

A simple maven cmd activates this:

mvn clean install -PnoAspectJ
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top