Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As the others suggested, scope=provided or scope=test is the way to go.</p> <ol> <li><code>&lt;scope&gt;provided&lt;/scope&gt;</code> implies that the library will be present in the target system and doesn't need to be deployed. (Or in some cases like log4j must not be deployed, because otherwise classloader issues will result)</li> <li><code>&lt;scope&gt;test&lt;/scope&gt;</code> suggests that the dependency is only needed for test code (and hence will not be needed or provided on the target system)</li> </ol> <p>Here is the relevant documentation:</p> <p><a href="http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope" rel="nofollow noreferrer">Introduction to the Dependency Mechanism</a></p> <p>On a related note: A different use case is that where you use different databases on different servers. You can use profiles to deploy the correct drivers:</p> <pre><code>&lt;profiles&gt; &lt;profile&gt; &lt;id&gt;testserver&lt;/id&gt; &lt;dependencies&gt; &lt;dependency&gt; ... (database driver a) &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/profile&gt; &lt;profile&gt; &lt;id&gt;productionserver&lt;/id&gt; &lt;dependencies&gt; &lt;dependency&gt; ... (database driver b) &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/profile&gt; &lt;profile&gt; &lt;id&gt;localdevelopment&lt;/id&gt; &lt;activation&gt; &lt;activeByDefault&gt;true&lt;/activeByDefault&gt; &lt;/activation&gt; &lt;dependencies&gt; &lt;dependency&gt; ... (database driver c) &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/profile&gt; &lt;/profiles&gt; </code></pre> <p>That way, if you just call <code>mvn install</code>, driver c will be deployed, whereas <code>mvn install -Ptestserver</code> and <code>mvn install -Pproductionserver</code> will include drivers a or b, respectively.</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