Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing Maven To Add Root Path
    primarykey
    data
    text
    <p>I am using the <code>copy-maven-plugin</code> provided by <code>com.github.goldin</code>. I want to copy some files through Maven.</p> <p>However, I don't want to hard code the path as the drive will be different. For example:</p> <pre><code>&lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;com.github.goldin&lt;/groupId&gt; &lt;artifactId&gt;copy-maven-plugin&lt;/artifactId&gt; &lt;version&gt;0.2.5&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;create-archive&lt;/id&gt; &lt;phase&gt;test&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;copy&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;resources&gt; &lt;resource&gt; &lt;targetPath&gt;/../src/Server-Parent/src/test/resources&lt;/targetPath&gt; &lt;file&gt;/../src/Server-Parent/DB/src/test/resources/mongoDB.xml&lt;/file&gt; &lt;destFileName&gt;mongoDB.xml&lt;/destFileName&gt; &lt;/resource&gt; &lt;/resources&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </code></pre> <p>When I hard code for example, <code>C:\folder name\src\Server-Parent\src\test\resources</code> it works perfectly from any Maven project. However as soon as I put <code>../src</code> or <code>/../src</code> it contains problems.</p> <p>Any ideas how I can fix this?</p> <pre><code>[ERROR] Failed to execute goal com.github.goldin:copy-maven-plugin:0.2.5:copy (c reate-archive) on project Server-Parent: Processing &lt;resource&gt; [Target p ath(s) [/../src/Server-Parent/src/test/resources], directory [C:/folder name\src/Server-Parent/DB/src/test/resources], dependencies []] fa iled with [java.lang.AssertionError]: [C:\folder name\src\Server-Parent\DB\sr c\test\resources] does not exist. Expression: d.directory -&gt; [Help 1] [ERROR] </code></pre> <p>EDIT 2:</p> <p>What I am trying to achive:</p> <p>I have Server-Parent which is pom.xml containing pom value. Inside this is another Server-SubParent containing pom.xml pom value. Now inside this is Server-SubFunctionality containing jar.</p> <p>Accoriding to your answer how can this be achived:</p> <p>${project.basedir}</p> <p>This are three projects where the Server-SubParent is a module of Server-Parent, but Server-SubParent is another pom containing another module containing the real functionality.</p> <pre><code>Server-Parent &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;Server-Parent&lt;/artifactId&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;name&gt;Server-Parent&lt;/name&gt; &lt;modules&gt; &lt;module&gt;Server-Sub-Parent&lt;/module&gt; &lt;/modules&gt; Server-SubParent &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; &lt;groupId&gt;com.server&lt;/groupId&gt; &lt;artifactId&gt;Server-Parent&lt;/artifactId&gt; &lt;version&gt;S06B1-RELEASE&lt;/version&gt; &lt;/parent&gt; &lt;artifactId&gt;Server-Sub-Parent&lt;/artifactId&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;name&gt;Server-Sub-Parent&lt;/name&gt; &lt;modules&gt; &lt;module&gt;Server-Sub-ParentFunctionality&lt;/module&gt; &lt;/modules&gt; Server-Sub-Parent-Functionality &lt;parent&gt; &lt;groupId&gt;com.server&lt;/groupId&gt; &lt;artifactId&gt;Server-Sub-Parent&lt;/artifactId&gt; &lt;version&gt;S06B1-RELEASE&lt;/version&gt; &lt;/parent&gt; &lt;artifactId&gt;Server-Sub-Parent-Functionality&lt;/artifactId&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;name&gt;Server-Sub-Parent-Functionality&lt;/name&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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