Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there anyway to exclude artifacts inherited from a parent POM?
    text
    copied!<p>Artifacts from dependencies can be excluded by declaring an <code>&lt;exclusions&gt;</code> element inside a <code>&lt;dependency&gt;</code> But in this case it's needed to exclude an artifact inherited from a parent project. An excerpt of the POM under discussion follows:</p> <pre class="lang-xml prettyprint-override"><code>&lt;project&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;test&lt;/groupId&gt; &lt;artifactId&gt;jruby&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;parent&gt; &lt;artifactId&gt;base&lt;/artifactId&gt; &lt;groupId&gt;es.uniovi.innova&lt;/groupId&gt; &lt;version&gt;1.0.0&lt;/version&gt; &lt;/parent&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.liferay.portal&lt;/groupId&gt; &lt;artifactId&gt;ALL-DEPS&lt;/artifactId&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;type&gt;pom&lt;/type&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <p><code>base</code> artifact, depends on <code>javax.mail:mail-1.4.jar</code>, and <code>ALL-DEPS</code> depends on another version of the same library. Due to the fact that <code>mail.jar</code> from <code>ALL-DEPS</code> exist on the execution environment, although not exported, collides with the <code>mail.jar</code> that exists on the parent, which is scoped as <code>compile</code>.</p> <p>A solution could be to rid off mail.jar from the parent POM, but most of the projects that inherit base, need it (as is a transtive dependency for log4j). So What I would like to do is to simply <strong>exclude parent's library from the child project</strong>, as it could be done if <code>base</code> was a dependency and not the parent pom:</p> <pre class="lang-xml prettyprint-override"><code>... &lt;dependency&gt; &lt;artifactId&gt;base&lt;/artifactId&gt; &lt;groupId&gt;es.uniovi.innova&lt;/groupId&gt; &lt;version&gt;1.0.0&lt;/version&gt; &lt;type&gt;pom&lt;type&gt; &lt;exclusions&gt; &lt;exclusion&gt; &lt;groupId&gt;javax.mail&lt;/groupId&gt; &lt;artifactId&gt;mail&lt;/artifactId&gt; &lt;/exclusion&gt; &lt;/exclusions&gt; &lt;/dependency&gt; ... </code></pre>
 

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