Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I want the jar to be in a 3rdparty lib in source control, and link to it by relative path from the pom.xml file.</p> </blockquote> <p>If you really want this (understand, if you can't use a corporate repository), then my advice would be to use a "file repository" local to the project and to <strong>not use</strong> a <code>system</code> scoped dependency. The <code>system</code> scoped should be avoided, such dependencies don't work well in many situation (e.g. in assembly), they cause more troubles than benefits. </p> <p>So, instead, declare a repository local to the project:</p> <pre><code>&lt;repositories&gt; &lt;repository&gt; &lt;id&gt;my-local-repo&lt;/id&gt; &lt;url&gt;file://${basedir}/my-repo&lt;/url&gt; &lt;/repository&gt; &lt;/repositories&gt; </code></pre> <p>Install your third party lib in there using <code>install:install-file</code> with the <a href="http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html#localRepositoryPath" rel="noreferrer"><code>localRepositoryPath</code></a> parameter:</p> <p><strike></p> <pre><code>mvn install:install-file -Dfile=&lt;path-to-file&gt; -DgroupId=&lt;myGroup&gt; \ -DartifactId=&lt;myArtifactId&gt; -Dversion=&lt;myVersion&gt; \ -Dpackaging=&lt;myPackaging&gt; -DlocalRepositoryPath=&lt;path&gt; </code></pre> <p></strike></p> <p><strong>Update:</strong> It appears that <code>install:install-file</code> ignores the <code>localRepositoryPath</code> when using the version 2.2 of the plugin. However, it works with version 2.3 and later of the plugin. So use the fully qualified name of the plugin to specify the version:</p> <pre><code>mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file \ -Dfile=&lt;path-to-file&gt; -DgroupId=&lt;myGroup&gt; \ -DartifactId=&lt;myArtifactId&gt; -Dversion=&lt;myVersion&gt; \ -Dpackaging=&lt;myPackaging&gt; -DlocalRepositoryPath=&lt;path&gt; </code></pre> <p><a href="http://maven.apache.org/plugins-archives/maven-install-plugin-2.3.1/install-file-mojo.html" rel="noreferrer">maven-install-plugin documentation</a></p> <p>Finally, declare it like any other dependency (but without the <code>system</code> scope):</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;your.group.id&lt;/groupId&gt; &lt;artifactId&gt;3rdparty&lt;/artifactId&gt; &lt;version&gt;X.Y.Z&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>This is IMHO a better solution than using a <code>system</code> scope as your dependency will be treated like a good citizen (e.g. it will be included in an assembly and so on).</p> <p>Now, I have to mention that the "right way" to deal with this situation in a corporate environment (maybe not the case here) would be to use a corporate repository.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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