简体   繁体   中英

Using third party lib with maven

I'm trying to use Synthetica library with maven but I failed.

There are 2 different jar file I need to import. First one is synthetica.jar and the other one is syntheticablackeye.jar.

I tried mvn install:install-file but it didn't solve the problem. I can use them with eclipse but currently I do not use any IDE like eclipse also I'm on linux.

Steps I have done:

(This is for synthetica.jar)

mvn install:install-file -Dfile=~/Dropbox/github/ChatAppServer/synthetica.jar -DgroupId=de.javasoft.plaf -DartifactId=synthetica -Dversion=1.0.0 -Dpackaging=jar

(This is for syntheticaBlackEye.jar)

mvn install:install-file -Dfile=~/Dropbox/github/ChatAppServer/syntheticaBlackEye.jar -DgroupId=de.javasoft.plaf -DartifactId=synthetica -Dversion=1.0.0 -Dpackaging=jar

the problem is how should I add dependency when the to jar files file structers are same?

I did these and It worked fine but when I check local mvn repos in my pc(.m2/repo/) there were no jar files. synthetica and syntheticablackeye file structers are same is this a problem? If it is what can I do?

What am I missing?

Edit: When I change artifactId and groupId maven trying to download jar files but they are in local repo?

You have not supplied any details about any errors you are getting or what command you used exactly to install the JARs, so it is hard to know what exactly is not working.

You can install 3rd party JAR files in your local Maven repository with a command like this (see also Maven's Guide to installing 3rd party JARs ):

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
    -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

For example:

mvn install:install-file -Dfile=synthetica.jar -DgroupId=com.synthetica
    -DartifactId=synthetica -Dversion=1.0 -Dpackaging=jar

Then you refer to it in the pom.xml of your project with the same Maven coordinates:

<dependency>
    <groupId>com.synthetica</groupId>
    <artifactId>synthetica</artifactId>
    <version>1.0</version>
</dependency>

edit - Do not use the same groupId, artifactId and version for both JAR files, otherwise Maven cannot tell them apart.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM