Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I don't know <em>exactly</em> why the <code>${project.parent.basedir}</code> is not "available" from AntRun, maybe it's just not supported (see <a href="http://jira.codehaus.org/browse/MNG-3597" rel="noreferrer">http://jira.codehaus.org/browse/MNG-3597</a>).</p> <p>Here is an horrible workaround using gmaven:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.codehaus.gmaven&lt;/groupId&gt; &lt;artifactId&gt;gmaven-plugin&lt;/artifactId&gt; &lt;version&gt;1.3&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;set-custom-property&lt;/id&gt; &lt;phase&gt;validate&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;execute&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;source&gt; project.properties.setProperty('main.basedir', project.parent.basedir.toString()) &lt;/source&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-antrun-plugin&lt;/artifactId&gt; &lt;version&gt;1.6&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;render-parameter-sql&lt;/id&gt; &lt;phase&gt;validate&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;run&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;target&gt; &lt;echo&gt;project.artifactId : ${project.artifactId}&lt;/echo&gt; &lt;echo&gt;project.parent.basedir : ${project.parent.basedir}&lt;/echo&gt; &lt;echo&gt;main.basedir : ${main.basedir}&lt;/echo&gt; &lt;echo&gt;project.basedir : ${project.basedir}&lt;/echo&gt; &lt;echo&gt;project.build.directory : ${project.build.directory}&lt;/echo&gt; &lt;/target&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>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):</p> <pre> $ 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} <b>[echo] main.basedir : /home/pascal/Projects/stackoverflow</b> [echo] project.basedir : /home/pascal/Projects/stackoverflow/Q4040778 [echo] project.build.directory : /home/pascal/Projects/stackoverflow/Q4040778/target [INFO] Executed tasks ... </pre> <p>But I need to say that what you want to do (<em>from this module I need the root of the parent to reach other modules</em>) is a <strong>bad practice</strong>, modules should be self contained and not tightly coupled.</p> <p>I do not recommend using what I posted :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload