Solved

Why external jar's package not  recognised

Posted on 2013-11-15
3
248 Views
Last Modified: 2013-12-16
I have added external jar to my project. upon maven package or install i get a error that :
package com.iess.son.common.data.alarm does not exist.

My code is using a class file under that package. In editor i do not see any compilation error.
0
Comment
Question by:pvinodp
3 Comments
 
LVL 11

Accepted Solution

by:
Manish earned 250 total points
ID: 39650833
You can put that in local mavenrepository and entry in pom.xml.
0
 
LVL 35

Assisted Solution

by:mccarl
mccarl earned 250 total points
ID: 39655169
I have added external jar to my project
That sounds like you are adding it via the Eclipse IDE's "Build Path" dialog box? Is that correct?  If so, then that is the reason for the error. You are telling Eclipse about the JAR and so you AREN'T getting any errors in Eclipse, but maven is a different thing. It doesn't look at Eclipse's build path, it just looks at what dependencies that you have set in your pom.xml file. So when you are building/installing/packaging via maven that jar isn't being included.

You need to follow @karanw's brief advice and install the jar to your local repository. If the jar is owned by you and it too is a maven project, then by doing a "maven install" on that project should get it into your local repository. Otherwise you can run the following command...
mvn install:install-file -Dfile=<path-to-jar-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=jar

Open in new window

(Replacing all the <xxx> values with appropriate values for the jar file path and maven groupId, artifactId and version values that you decide on.) Then add a new <dependency> element into you pom.xml which references that above maven groupId, artifactId and version values that you have chosen.
0
 

Author Closing Comment

by:pvinodp
ID: 39723191
thanks
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question