Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6661269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:15:31+00:00 2026-05-26T02:15:31+00:00

I have set up a parent POM for use by all my projects with

  • 0

I have set up a parent POM for use by all my projects with standard configuration. I’ve been playing with the maven-java-formatter-plugin and using my own formatter config file. In the parent POM I’ve set this up:

    <build>
    ...
        <!-- Format the code during process-sources -->
        <plugin>
            <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
            <artifactId>maven-java-formatter-plugin</artifactId>
            <version>${formatter.version}</version>
            <executions>
                <execution>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>format</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <!-- Use plugin to compiler config vice those in formatter config 
                    file -->
                <overrideConfigCompilerVersion>true</overrideConfigCompilerVersion>
                <compilerSource>${jdk.version}</compilerSource>
                <compilerCompliance>${jdk.version}</compilerCompliance>
                <compilerTargetPlatform>${jdk.version}</compilerTargetPlatform>
                <!-- Use Unix line endings -->
                <lineEnding>LF</lineEnding>
                <!-- The formatter config file -->
                <configFile>${project.basedir}/formatter-config.xml</configFile>
            </configuration>
        </plugin>
    </plugins>
</build>

But this requires that I include the formatter-config.xml in each project. What I’d like to somehow do is automatically retrieve/copy that file from some known location (possibly another project whose only purpose is to hold this file) into all the projects automagically during the build phase. I’m pretty sure there’s a way to do this, but I can’t come up with the right search terms.

EDIT (response to prunge)

I put the config file in a separate project (packaged as a jar) and added that as a dependency to my parent POM. However, when I try to build a project that makes use of the parent POM, I get this error:

[ERROR] Failed to execute goal com.googlecode.maven-java-formatter-plugin:maven-java-formatter-plugin:0.3.1:format (default) on project TestServlet: Config file [eclipse/formatter-config.xml] cannot be found: Could not find resource 'eclipse/formatter-config.xml'. -> [Help 1]

It appears that the formatter-config.xml file is not being resolved from the classpath as per the formatter plugin page you referenced.

This is what I have; perhaps you can tell me where I went wrong:

CodeFormatter (builds a jar)
|-- pom.xml
|-- src
|   `-- main
|       `-- resources
|           `-- eclipse
|               `-- formatter-config.xml

Parent POM is same as above but have added new dependency:

<groupId>my.company</groupId>
<artifactId>super-pom</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
....
<dependencies>
    <dependency>
        <groupId>my.company</groupId>
        <artifactId>code-formatter</artifactId>
        <version>1.0</version>
    </dependency>
</dependencies>
...

No changes to the TestServlet project POM; it includes the parent POM:

<parent>
    <groupId>my.company</groupId>
    <artifactId>super-pom</artifactId>
    <version>1.0</version>
</parent>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:15:32+00:00Added an answer on May 26, 2026 at 2:15 am

    See Multimodule Configuration example from the plugin site.

    Essentially, you create a project which just has the formatter-config.xml file in it, build and deploy this project to your repository, then add this dependency to the plugin itself in your parent POM.

    e.g.

    <plugin>
        <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
        <artifactId>maven-java-formatter-plugin</artifactId>
        <version>${formatter.version}</version>
        <executions>
            <execution>
                <phase>process-resources</phase>
                <goals>
                    <goal>format</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <!-- Use plugin to compiler config vice those in formatter config 
                file -->
            <overrideConfigCompilerVersion>true</overrideConfigCompilerVersion>
            <compilerSource>${jdk.version}</compilerSource>
            <compilerCompliance>${jdk.version}</compilerCompliance>
            <compilerTargetPlatform>${jdk.version}</compilerTargetPlatform>
            <!-- Use Unix line endings -->
            <lineEnding>LF</lineEnding>
            <!-- The formatter config file -->
            <configFile>eclipse/formatter-config.xml</configFile>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.myorg.buildutils</groupId>
            <artifactId>my-eclipse-config</artifactId>
            <version>1.0</version>
          </dependency>
        </dependencies>
    </plugin>
    

    where in your buildutils project, the formatter-config.xml file will put into src/main/resources/eclipse/ directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try do the following: I have a standard POM defined for all my
So I have a set up similar to this questions: Parent Child Setup Everything
I have parent/child relationship set up via Node Reference. A Child record can have
I have a parent form that is set to be TopMost and then I
I have a large result set assembled in a parent/child relationship. I need to
I have a parent class which contains a child object. I am using set
I have two entities: public class Parent() { public ICollection<Child> Children { get; set;
I have a tree structure where each Node has a parent and a Set<Node>
Parent is a UIImageView, child is a UIImageView. Both have enable user interaction set
I have a Git repository that contains a bunch of top-level maven projects (each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.