revelc/formatter-maven-plugin

Load configuration from a dependency

Closed this issue · 1 comments

Is your feature request related to a problem? Please describe.
I want to package my configurations inside a Maven artifact. Then I need to load these configurations from a Maven dependency (on the classpath).

Describe the solution you'd like

<plugin>
    <groupId>net.revelc.code.formatter</groupId>
    <artifactId>formatter-maven-plugin</artifactId>
    <version>2.17.1</version>
    <dependencies>
      <dependency>
        <groupId>my.group</groupId>
        <artifactId>my-artifact</artifactId>
        <version>my.version</version>
      </dependency>
    </dependencies>
    <configuration>
      <configFile>eclipse/java-code-formatter.xml</configFile>
    </configuration>
    ...
</plugin>

With the project my-artifact containing:

src
├── main
│   └── resources
│       ├── checkstyle // this kind of setup works with CheckStyle
│       ├── eclipse
│       │   ├── java-code-formatter.xml

Which is packaged as:

my-artifact-my.version.jar
├── checkstyle // this kind of setup works with CheckStyle
├── eclipse
│   ├── java-code-formatter.xml

Describe alternatives you've considered
Unpack the artifact with maven-dependency-plugin before running the formater.

I'm really sorry, I just saw that I missed the documentation "Basic Configuration Using External Resource". I couldn't make it work because of a typo.