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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:36:17+00:00 2026-05-17T22:36:17+00:00

There is a multi-module project. Inside the child I need to do some complicated

  • 0

There is a multi-module project. Inside the child I need to do some complicated stuff (integration test with deploying to application server and so on). So there is an integrationtest child, and from this module I need the root of the parent to reach other modules. I do not want to use “..”. There is a property in integrationtest POM:

<properties>
 <main.basedir>${project.parent.basedir}</main.basedir>
    ...
</properties>

And there is an antrun plugin with the following content:

<plugins>
 <plugin>
  <artifactId>maven-antrun-plugin</artifactId>
  <executions>
   <execution>
    <id>render-parameter-sql</id>
    <phase>validate</phase>
    <goals>
     <goal>run</goal>
    </goals>
    <configuration>
     <tasks>
      <echoproperties/>
     </tasks>
    </configuration>
   </execution>
  </executions>
 </plugin>
</plugins>

In the output, the main.basedir is not resolved:

main:
[echoproperties] #Ant properties
[echoproperties] #Thu Oct 28 09:32:13 CEST 2010
[echoproperties] ant.core.lib=C\:\\Users\\gaborl\\.m2\\repository\\org\\apache\\ant\\ant\\1.8.1\\ant-1.8.1.jar
...
[echoproperties] main.basedir=${project.parent.basedir}
[echoproperties] maven.dependency.antlr.antlr.jar.path=C\:\\Users\\gaborl\\.m2\\repository\\antlr\\antlr\\2.7.6\\antlr-2.7.6.jar

After becoming really angry I decided to ask you how to get around this…

  • 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-17T22:36:17+00:00Added an answer on May 17, 2026 at 10:36 pm

    I don’t know exactly why the ${project.parent.basedir} is not “available” from AntRun, maybe it’s just not supported (see http://jira.codehaus.org/browse/MNG-3597).

    Here is an horrible workaround using gmaven:

    <plugin>
      <groupId>org.codehaus.gmaven</groupId>
      <artifactId>gmaven-plugin</artifactId>
      <version>1.3</version>
      <executions>
        <execution>
          <id>set-custom-property</id>
          <phase>validate</phase>
          <goals>
            <goal>execute</goal>
          </goals>
          <configuration>
            <source>
              project.properties.setProperty('main.basedir', project.parent.basedir.toString())
            </source>
          </configuration>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <artifactId>maven-antrun-plugin</artifactId>
      <version>1.6</version>
      <executions>
        <execution>
          <id>render-parameter-sql</id>
          <phase>validate</phase>
          <goals>
            <goal>run</goal>
          </goals>
          <configuration>
            <target>
              <echo>project.artifactId        : ${project.artifactId}</echo>
              <echo>project.parent.basedir    : ${project.parent.basedir}</echo>
              <echo>main.basedir              : ${main.basedir}</echo>
              <echo>project.basedir           : ${project.basedir}</echo>
              <echo>project.build.directory   : ${project.build.directory}</echo>
            </target>
          </configuration>
        </execution>
      </executions>
    </plugin>
    

    I’m not proud of it, but it kinda “works” (if a string representation of the path to the parent basedir is ok for you):

    $ mvn validate
    [INFO] Scanning for projects...
    ...
    [INFO] --- maven-antrun-plugin:1.6:run (render-parameter-sql) @ Q4040778 ---
    [INFO] Executing tasks
    
    main:
         [echo] project.artifactId        : Q4040778
         [echo] project.parent.basedir    : ${project.parent.basedir}
         [echo] main.basedir              : /home/pascal/Projects/stackoverflow
         [echo] project.basedir           : /home/pascal/Projects/stackoverflow/Q4040778
         [echo] project.build.directory   : /home/pascal/Projects/stackoverflow/Q4040778/target
    [INFO] Executed tasks
    ...
    

    But I need to say that what you want to do (from this module I need the root of the parent to reach other modules) is a bad practice, modules should be self contained and not tightly coupled.

    I do not recommend using what I posted 🙂

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

Sidebar

Related Questions

I have a maven2 multi-module project and in each of my child modules I
I'm having a hard time to make my Maven2 multi module project, with a
I have a multi-module project and I would like to define a single filter
Basically, I have a multi-module project consisting of 5 different modules. One of the
I am trying to setup the assembly plugin for a large multi-module project. The
I have a multi-module maven project (several levels of nesting). Normally, when I execute
Does anyone know if there are any multi-line row grid controls for sale or
Is there a way to disable entering multi-line entries in a Text Box (i.e.,
Is there a built-in editor for a multi-line string in a PropertyGrid .
There is a way to keep the scroll on bottom for a multi line

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.