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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:05:48+00:00 2026-05-18T06:05:48+00:00

I want to create a maven project with the following structure: A |–pom.xml |–B

  • 0

I want to create a maven project with the following structure:

A
|--pom.xml
|--B
   |--pom.xml
|--C
   |--pom.xml

where A, B and C are folders, and B’s pom.xml and C’s pom.xml are children of A’s pom.xml. I want to have in B’s pom.xml the following section:

<properties>
   <some.property>B</some.property>
</properties>

And in C:

<properties>
   <some.property>C</some.property>
</properties>

And I want in A something to define the value of several other properties based on the value of some property. So for example, in pseudocode, A would do something like this:

if ( some.property == 'B') then
    some.other.property = 'some-value-based-on-b'
else if ( some.property == 'C') then
    some.other.property = 'some-value-based-on-c'
...

I want to run the mvn clean install referring to A’s pom.xml (which contains a module section pointing to B and C), so, as far as I understand, I cannot use profiles for this (since in maven2 projects running in the same reactor inherits the same active profile. I can use maven3, but couldn’t find if it changes anything).

Does anyone has any idea how to do this?

Thanks,

  • 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-18T06:05:49+00:00Added an answer on May 18, 2026 at 6:05 am

    Out of the box, maven can’t do this, and workarounds are discouraged (the properties are not supposed to change during the lifecycle).

    There are several workarounds though, my favorite being the gmaven plugin, which lets you embed Groovy code in the pom.

    The following code snippet will set the property ‘abc’ to either ‘bar’ or ‘baz’, depending on whether the property ‘def’ contains ‘foo’:

    <plugin>
        <groupId>org.codehaus.gmaven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <version>1.3</version>
        <executions>
            <execution>
                <phase>validate</phase>
                <goals>
                    <goal>execute</goal>
                </goals>
                <configuration>
                    <source><![CDATA[
    pom.properties['abc']=
       pom.properties['def'].contains('foo') ? 'bar' : 'baz';
                    ]]></source>
                </configuration>
            </execution>
        </executions>
    </plugin>
    

    BTW, the docs are outdated, the plugin version is now 1.3 and the groupId has changed. Here’s the current version.

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

Sidebar

Related Questions

I installed m2eclipse plugin. I want to create pom.xml in my project which is
I have a maven project with the following POM snippet: <modelVersion>4.0.0</modelVersion> <artifactId>Foo-Deploy</artifactId> <name>Foo-Deploy</name> <packaging>pom</packaging>
I have a Maven project that looks like the following: - enterprise-pom - commons
I have a Maven project multimodule project. Some of the modules create custom packaging
I want to create a maven project, which has to depend on a non
I have a maven project which uses the shade plugin to create a jar
I have a Java multi-module Maven project that I want to build an MVN
I want to create a Maven Project in eclipse using m2eclipse plugin, which will
I'm new to maven and have got a project with some dependencies. Now Maven
I have a maven project with the following packages (for illustration only): Root: src/main/java

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.