Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to tell Maven to include the jar dependency, not the subproject source directory in Eclipse?
    primarykey
    data
    text
    <p>I use Apache Maven to manage my Java libs (jar) and some of projects that use the libs. For convinience, I use <code>mvn eclipse:eclipse</code> to generate <em>Eclipse project files</em> which can be imported into Eclipse workspace for editing.</p> <p>Problems arise when I edit the main project and Java lib projects in the same Eclipse workspace. That is, <code>mvn eclipse:eclipse</code> includes <strong>src path</strong> dependency in <code>.classpath</code> file, not the <code>jar</code> dependency as expected.</p> <p>Say I have a Jave lib project named <code>mylib</code>. The corresponding jar file <code>mylib.jar</code> has been deployed to a private Maven repo maintained by me. In order to use mylib.jar in the main project, the following dependency is included in <code>pom.xml</code>.</p> <pre><code>&lt;!-- pom.xml for the main project --&gt; &lt;dependency&gt; &lt;groupId&gt;namespace.my&lt;/groupId&gt; &lt;artifactId&gt;mylib&lt;/artifactId&gt; &lt;version&gt;[1.0, )&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p><code>mvn compile</code> and <code>mvn test</code> work perfect, in which <code>mylib.jar</code> is automatically downloaded from my repo. However, when trying <code>mvn eclipse:eclipse</code>, I find the generated <code>.classpath</code> file doesn't include <code>mylib.jar</code> dependency as expected. Instead, it includes source file directory for mylib as follows.</p> <pre><code>&lt;!-- .classpath file generated by mvn eclipse:eclipse --&gt; &lt;classpathentry kind="src" path="/mylib"/&gt; </code></pre> <p>It seems that Maven reads Eclipse's metadata and finds mylib and the main project coexits in the same workspace. Therefore maven includes the source for my good. Damn. How can I tell maven to ignore the local project source and just include the jar file?</p>
    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