Intellij Plugin order of execution with Maven plugin


My goal is to read a property from a pom.xml, then update intellij's "packagePrefix" for a source folder automatically. Im able to sucessfully read from the pom, then update the packagePrefix using this code:


val packagePrefix : Option[String] = mavenProject.getProperties.getProperty("packagePrefix").toOption

packagePrefix foreach(prefix => {
  val modifiableRoot = modelsProvider.getModifiableRootModel(module)
  val contents = modifiableRoot.getContentEntries
  contents.foreach(content => {
    content.getSourceFolders.foreach(sourceFolder => {


However, the Maven plugin will then overwrite my changes removing the packagePrefix from my source folder. The documentation on Intellij-Plugin writing is a bit difficult to parse and I cant find things like event start/end for say Maven importing.

How can I schedule my plugin to execute after the existing Intellij-Plugin for maven? Also, how did you determine the order of plugin execution? I could not find anything in the documentation.

Please note: This is for Intellij-Plugins and the Maven plugin for the Intellij IDE, not maven-plugins.


1 comment
Comment actions Permalink

Try to create your own class inherited from `org.jetbrains.idea.maven.importing.MavenImporter` (pass nulls to constructor and override `isApplicable`) and in `process` method add your own postTask

There is quite hard to make point "end of maven importing", because execution of your plugin also the part of the importing.


Please sign in to leave a comment.