Search code examples
mavenaspectjaspectj-maven-plugin

Is there a way I can have the aspectj maven plugin ignore missing weave dependencies instead of failing the build?


I wrote an aspect library that auto-instruments traces and because most of the developers using this have multi-module projects, it would be nice if they could just configure the aspectj-maven-plugin for compile-time weaving in the parent pom.xml instead of each module's pom.xml. The problem is that not all modules require certain weave dependencies and as such I would like it if the plugin could ignore those missing dependencies when weaving those modules instead of failing the build. Is this even possible?


Solution

  • Configure plugin version and common settings in the parent's pluginManagement section, then simply add the plugin group ID and name to each module's plugins section where it is needed, optionally amending or changing the configuration. Adding a plugin to the parent POM even though not all modules use it, is simply wrong from a Maven perspective.