Don Cheadle
Don Cheadle

Reputation: 5586

How to tell Eclipse not include project reference, instead get JAR for custom dependency in local repo

I have two libraries which are built with Maven, and then installed into the local repo.

In my application, I'm using these two libraries and so I reference them in my pom in standard way:

<dependency>
  <groupId>...</groupId>
  <artifactId>simple-google-drive-manager</artifactId>
  <version>1.0-SNAPSHOT</version
</dependency>

<dependency>
  <groupId>...</groupId>
  <artifactId>PdfBoxUtils</artifactId>
  <version>1.0-SNAPSHOT</version
</dependency>

Two libs are PdfBoxUtils and simple-google-drive-manager

In Eclipse, under Maven Dependencies, most things are listed as artifactId-version.jar as expected. But for the custom libraries I made, Eclipse recognizes they are in same workspace and instead of including jar, includes the project itself.

enter image description here

I don't want this! It's confusing, and I want to be able to force this project to use the locally installed library, not just whatever is currently in the library project's source.

How do I get eclipse to actually use the JAR from local repo rather than referencing local proejct?

Upvotes: 2

Views: 3526

Answers (2)

K.Nicholas
K.Nicholas

Reputation: 11561

You have to have a maven project, which can be done with ->Configure->Convert to Maven Project. Then add an entry for your local repo into your pom:

<repositories>
    <repository>
        <id>project.local</id>
        <name>project</name>
        <url>file:${project.basedir}/repo</url>
    </repository>
</repositories>

After that, you need to use Maven install:install-file to copy the jar and associated .pom into the repository.

Finally, of course, add a dependency for the file to your pom.

Upvotes: 0

hgrey
hgrey

Reputation: 3093

Select Maven->Disable Workspace resolution in context menu of the project.

Upvotes: 7

Related Questions