Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add External JAR in Maven Dependency

Tags:

maven

I am trying to add external JAR file tigase-muc in a maven based project tigase-server in eclipse IDE.
I have tried following method

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
[INFO] Scanning for projects...
[INFO] 
[INFO] Building Tigase XMPP Server 5.1.0 5.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3:install-file (default-cli) @ tigase-server ---
[INFO] Installing /home/haider/Downloads/tigase-muc-2.2.0.jar to /
home/haider/.m2/repository/tigase/tigase-muc/2.2.0/tigase-muc-2.2.0.jar
[INFO] --------------
[INFO] BUILD SUCCESS
[INFO] -------------
[INFO] Total time: 0.791s
[INFO] Finished at: Mon Aug 05 18:06:48 PKT 2013
[INFO] Finished at: Mon Aug 05 18:06:48 PKT 2013
[INFO] ----------------------

From above BUILD SUCCESS message i assume that JAR file is correctly added , but when i add following dependency in POM file

        <dependency>
        <groupId>tigase</groupId>
        <artifactId>tigase-xmltools</artifactId>
        <version>3.3.6</version>
        <scope>compile</scope>
    </dependency>

It give me following error Missing artifact tigase:tigase-muc. This message clearly indicate that it didn't get the JAR file that i am referring in dependency

You Contribution will be highly appreciated THANKS

like image 766
Haider Ali Avatar asked Oct 21 '22 03:10

Haider Ali


2 Answers

It looks like it installs the Jar like this: [INFO] Installing /home/haider/Downloads/tigase-muc-2.2.0.jar to / home/haider/.m2/repository/tigase/tigase-muc/2.2.0/tigase-muc-2.2.0.jar

As maven works, its group id is resolved to be ''tigase'', artifactId is ''tigase-muc'', version is ''2.2.0'' So this is right.

Now, I've took a look on tigase:tigase-xmltools:3.3.6 available here

It doesn't define any dependency at all.

So it looks like this would happen even if you don't specify this dependency :)

I would suggest you to run mvn dependency:tree to see where does this dependency comes from

Hope this helps

like image 60
Mark Bramnik Avatar answered Oct 28 '22 22:10

Mark Bramnik


A more complete error message would help narrow down what's gone wrong. The artifact you installed should be resolvable via the following dependency:

<dependency>
    <groupId>tigase</groupId>
    <artifactId>tigase-muc</artifactId>
    <version>2.2.0</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

You're reference tigase-xmltools which I'm assuming has a dependency on tigase-muc.

My guess is tigase-xmltools might have dependency on the actual pom of tigase-muc, which you don't have despite having the jar. Seeing the full error message and the pom of tigase-xmltools.

Installing the file with -DgeneratePom=true might help.

like image 24
Eric Avatar answered Oct 28 '22 21:10

Eric