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:

```scala

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 => {
      sourceFolder.setPackagePrefix(prefix)
    })
  })
})

```

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.

 

0

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.

0

请先登录再写评论。