S
S
Sergey2015-04-10 21:53:31
Java
Sergey, 2015-04-10 21:53:31

How to connect local maven repository?

Hello!
The situation is this - I have some self-made JAR, and I need maven to see it as a dependency from the repository (not system-scope). However, there was a problem:
I sort of install the JAR in the local repository with the command

mvn install:install-file -Dfile=~/maven_local_rep/garm.jar -DgroupId=myappcustomfonts -DartifactId=garmondctt -Dversion=1 -Dpackaging=jar

However, eclipse does not see my jar when I specify the following dependency:
<dependency>
    <groupId>myappcustomfonts</groupId>
    <artifactId>garmondctt</artifactId>
    <version>1</version>
</dependency>

What am I doing wrong? If you look, then in the local repository (for ubuntu ~/.m2/repository ) the corresponding directory still appears.
What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-04-13
@Tookuk

Thanks for the help!
The problem was solved like this:
I discovered that a JAR is being put into the local repository, which for some reason does not match the original jar nickname in size, that is, the above command put a broken archive into the repository.
I just replaced the jar in the local repository with my hands.
After that everything worked.

T
Timur, 2015-04-11
@timych

Hmm, the command itself looks correct, at least everything was installed normally on my Windows machines. Is the project building normally? (Eclipse can be stupid for example until you do maven-> update project)
PS: Why don't you want to put the jar in the project itself? This is much more convenient, in the sense that it is not necessary to put the same jar in the local repository on each machine.
UPD: In response to your comment, I am writing here, because it is not possible to insert xml in a human way.
Regarding adding the library directly to the project:
Make a lib folder (or whatever you want to call it) in the root of the project and throw jar there. For example, I have the GWT-jQuery library in my lib folder. Then in pom.xml it will look like this:

<dependency>
    			<artifactId>GWT-jQuery</artifactId>
    <groupId>com.xedge.jquery.ui</groupId>
    			<scope>system</scope>
    <version>1.1</version>
    <systemPath>${basedir}/lib/gwt-jquery1.1.jar</systemPath>
    </dependency>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question