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 8036011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:28:42+00:00 2026-06-05T02:28:42+00:00

Suppose I have a Maven multi-module Java EE 6 app: foobar/ foobar-ear/ src/ main/

  • 0

Suppose I have a Maven multi-module Java EE 6 app:

foobar/
    foobar-ear/
        src/
            main/
                application/
                    META-INF/
                        MANIFEST.MF
                        glassfish-application.xml
                        glassfish-resources.xml
                filters/
                    dev.properties
                    prod.properties
                    test.properties
        pom.xml
    foobar-web/
    foobar-ejb/
    pom.xml

As you can see, I’m using resource filtering. The pom in foobar-ear defines the build profiles:

<profiles>
    <profile>
        <id>dev</id>
        <properties>
            <env>dev</env>
        </properties>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
    </profile>
    <profile>
        <id>test</id>
        <properties>
            <env>test</env>
        </properties>
    </profile>
    <profile>
        <id>demo</id>
        <properties>
            <env>demo</env>
        </properties>
    </profile>
    <profile>
        <id>prod</id>
        <properties>
            <env>prod</env>
        </properties>
    </profile>
</profiles>

And each child project’s pom defines resource filtering. In foobar-ear/pom.xml:

<build>
    ...

    <filters>
        <filter>src/main/filters/${env}.properties</filter>
    </filters>
    <resources>
        <resource>
            <directory>src/main/application</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/*.xml</include>
            </includes>
        </resource>
        <resource>
            <directory>src/main/application</directory>
            <filtering>false</filtering>
            <excludes>
                <exclude>**/*.xml</exclude>
            </excludes>
        </resource>
    </resources>

    ...
</build>

The intention here is to filter foobar-ear/src/main/application/META-INF/glassfish-resources.xml which contains placeholders for JDBC and JavaMail configuration items which are defined in the filter properties files.

When I build using mvn -Pdev clean install, I get this output in foobar-ear:

foobar-ear/
    target/
        classes/
            META-INF/
                MANIFEST.MF
                glassfish-application.xml
                glassfish-resources.xml    <- This one is filtered
        foobar-ear/
            META-INF/
                MANIFEST.MF
                glassfish-application.xml
                glassfish-resources.xml    <- This one is NOT filtered
            lib/
            foobar-ejb.jar
            foobar-web.war
        application.xml
        foobar-ear.ear                     <- ear file. Contents same as foobar-ear/

As you can see, the resources copied to the usual output location are filtered, but those in the EAR directory layout and ear file are not.

  • 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-06-05T02:28:43+00:00Added an answer on June 5, 2026 at 2:28 am

    I added <filtering>true</filtering> to the maven-ear-plugin configuration and now it works.

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <filtering>true</filtering>
                    [...]
                </configuration>
            </plugin>
            [...]
        </plugins>
        [...]
    </build>
    

    Reference: Filtering the sources

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

Sidebar

Related Questions

Suppose I have the following directory layout in a Maven project: src/ |-- main
I am trying to build a Java EE application using Maven. I have the
Suppose I have a Maven 2 Java project on my local machine. I build
I have a multi-module Maven project. It works fine in NetBeans. But not in
Suppose I have a war and jar projects defined in maven. The Jar project
Suppose I have a module A:jar , whose runtime and compilation set of dependencies
Suppose you have a HUGE application "develoopped" ;) by a big team. Here is
Suppose I have created an empty Maven project in Eclipse. What is the shortest
I have a modular project in which, for every single module, I use jaxb2-maven-plugin
I have a Java project and used the standard maven archetype to create the

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.