Note that there are some explanatory texts on larger screens.

plurals
  1. POIs this the correct way to enforce a specific Spring version using the enforcer plugin?
    text
    copied!<p>I wish to enforce a specific Spring version (3.1.2) using the <a href="http://maven.apache.org/plugins/maven-enforcer-plugin/index.html" rel="nofollow">maven-enforcer plugin</a>'s <strong><a href="http://maven.apache.org/enforcer/enforcer-rules/bannedDependencies.html" rel="nofollow">bannedDependencies</a></strong> rule.</p> <p>Is this the correct way to configure the enforcer plugin to achieve that ?</p> <pre><code>&lt;configuration&gt; &lt;rules&gt; &lt;bannedDependencies&gt; &lt;searchTransitive&gt;true&lt;/searchTransitive&gt; &lt;excludes&gt; &lt;exclude&gt;org.springframework&lt;/exclude&gt; &lt;/excludes&gt; &lt;includes&gt; &lt;include&gt;org.springframework:*:3.1.2&lt;/include&gt; &lt;/includes&gt; &lt;/bannedDependencies&gt; &lt;/rules&gt; &lt;fail&gt;true&lt;/fail&gt; &lt;failFast&gt;true&lt;/failFast&gt; &lt;ignoreCache&gt;true&lt;/ignoreCache&gt; &lt;/configuration&gt; </code></pre> <p>The above seems to work and doing a <code>mvn enforcer:enforce</code> on the command line highlighted that v3.1.0 or org.springframework:spring-oxm was being pulled in as a transitive dependency.</p> <p>It also seems like one might want to use <strong><a href="http://maven.apache.org/enforcer/enforcer-rules/dependencyConvergence.html" rel="nofollow">dependencyConvergence</a></strong> rule, but it highlights a lot of dependency errors which are excluded automatically as 'conflicts' by maven.</p> <p>Here is a snippet with a bit more context :</p> <pre><code>&lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-enforcer-plugin&lt;/artifactId&gt; &lt;version&gt;${maven.enforcer.plugin}&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;enforce-versions&lt;/id&gt; &lt;goals&gt; &lt;goal&gt;enforce&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;configuration&gt; &lt;rules&gt; &lt;bannedDependencies&gt; &lt;searchTransitive&gt;true&lt;/searchTransitive&gt; &lt;excludes&gt; &lt;exclude&gt;org.springframework&lt;/exclude&gt; &lt;exclude&gt;org.springframework.security&lt;/exclude&gt; &lt;exclude&gt;org.slf4j&lt;/exclude&gt; &lt;/excludes&gt; &lt;includes&gt; &lt;include&gt;org.springframework:*:${spring.version}&lt;/include&gt; &lt;include&gt;org.springframework.security:*:${spring-security.version}&lt;/include&gt; &lt;include&gt;org.slf4j:*:${slf4j.version}&lt;/include&gt; &lt;/includes&gt; &lt;/bannedDependencies&gt; &lt;requireJavaVersion&gt; &lt;version&gt;${enforce.jdk.version}&lt;/version&gt; &lt;/requireJavaVersion&gt; &lt;/rules&gt; &lt;fail&gt;true&lt;/fail&gt; &lt;failFast&gt;true&lt;/failFast&gt; &lt;ignoreCache&gt;true&lt;/ignoreCache&gt; &lt;/configuration&gt; &lt;/plugin&gt; ..... &lt;/plugins&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