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

  • Home
  • SEARCH
  • 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 417451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:34:53+00:00 2026-05-12T18:34:53+00:00

In my project, I have a resources directory ( src/main/resources ) that contains properties

  • 0

In my project, I have a resources directory (src/main/resources) that contains properties and XML files.

I want to filter only the properties files, but not any others kind of files (XML for example). Thus, I’ve set this in my pom.xml:

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/*.properties</include>
            </includes>
        </resource>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>false</filtering>
            <excludes>
                <exclude>**/*.properties</exclude>
            </excludes>
        </resource>
    </resources>
</build>

This is working well when I run a Maven 2 package command, i.e. both XML and properties files are included in my final JAR, and only properties files have been filtered.

However, as I want to include this project in Eclipse, when I run the command mvn eclipse:eclipse, and import the project, then I have a problem with the source declared in my project properties.

In the “Java Build Path” option of Eclipse for my project, in tab “Source”, I see the src/main/resources directory, but Eclipse also add filters which say to exclude all java files (Excluded: **/*.java) and include only properties files (Included: **/*.properties).

In the .classpath file generated, I get this line:

<classpathentry kind="src" path="src/main/resources" including="**/*.properties" excluding="**/*.java"/>

This way, the JAR built by Eclipse is not correct as all my XML files are not in the JAR.

How can I solve this problem?


Edit, regarding this page, I’ve added this in my pom.xml:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <sourceIncludes>
                    <sourceInclude>**/*.xml</sourceInclude>
                </sourceIncludes>
            </configuration>
        </plugin>
    </plugins>

However, the .classpath generated is not modified with the adequate information…


Edit again.

The addition in my previous edit works only for version 2.6.1+ of the Eclipse plugin, not for 2.6. So, I’ve tried with version 2.7. However, I don’t know how to force the Eclipse plugin to not define the including attribute:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <sourceIncludes>
                    <sourceInclude>*</sourceInclude>
                </sourceIncludes>
            </configuration>
        </plugin>
    </plugins>

If I run the mvn eclipse:eclipse command, I get the following error:

Request to merge when 'filtering' is not identical. Original=resource src/main/resources: output=target/classes, include=[**/*.properties], exclude=[**/*.java], test=false, filtering=true, merging with=resource src/main/resources: output=target/classes, include=[], exclude=[**/*.properties|**/*.java], test=false, filtering=false
  • 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-12T18:34:53+00:00Added an answer on May 12, 2026 at 6:34 pm

    I did some testing with the maven eclipse plugin 2.6, 2.5.1, 2.7 and 2.8-SNAPSHOT and none of them is indeed producing the expected result.

    The only workaround I’ve been able to find is to use another directory for the resources you don’t want to filter. Something like this:

      ...
      <build>
        <resources>
            <resource>
                <directory>src/main/resources1</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources2</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-eclipse-plugin</artifactId>
              <version>2.6</version>
          </plugin>
        </plugins>
      </build>
    

    I agree that this is ugly. But at least, it produces a .classpath with the following entries:

      <classpathentry kind="src" path="src/main/resources1" including="**/*.properties" excluding="**/*.java"/>
      <classpathentry kind="src" path="src/main/resources2" including="**/*.xml" excluding="**/*.java"/>
    

    That should allow you to deploy on Tomcat.

    By the way, I wouldn’t use the version 2.7 of the plugin because it’s not working (see this thread). The version 2.6 may not produce the expected output but at least, it works.

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

Sidebar

Related Questions

This is the directory structure of the project (maven2 is used): pom.xml /src /main
In a software-project written in java you often have resources, that are part of
I have config files and various documents that I want to copy from the
I've got maven project that I want to be able to move some properties
I have project that I'm working on that is going to require a webserver.
For a small project I have to parse pdf files and take a specific
In my DSL project I have a shape with a number of decorators that
In a recent project I have nearly completed we used an architecture that as
In my Silverlight project I have a thread that fires every x milliseconds. In
Within my Subversion project I have a few directories that contain other open source

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.