I want to be able to run detekt with --auto-correct as a maven task not tied to a specific phase, e.g. during local development to format source files. I created an execution inside maven-antrun-plugin without phase:
<execution>
<id>detekt-format</id>
<goals>
<goal>run</goal>
</goals>
...
I can run it with mvn -pl my-project antrun:run@detekt-format.
The problem is that I have a multi-module project structure, and detekt configuration is placed in parent pom dir (root directory). I use directory-maven-plugin to get the highest directory (since ${basedir} is tied to module directories).
THE PROBLEM: when I manually run this task I don't have access to the root directory path generated by directory-maven-plugin, is it possible with maven to run this plugin before running maven-antrun-plugin?
directory-maven-plugin configuration:
<plugin>
<groupId>org.commonjava.maven.plugins</groupId>
<artifactId>directory-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>directories</id>
<goals>
<goal>highest-basedir</goal>
</goals>
<phase>validate</phase>
<configuration>
<property>RootDir</property>
</configuration>
</execution>
</executions>
</plugin>