Chiranjit Ghosh
Chiranjit Ghosh

Reputation: 41

How to Solve Dependency Error in pom.xml

I am new in maven, I am getting this error while adding dependency in pom.xml file. Below is my pom.xml file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>CrunchifyRESTJerseyExample</groupId>
  <artifactId>CrunchifyRESTJerseyExample</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <dependencies>
    <dependency>
        <groupId>asm.jar</groupId>
        <artifactId>asm.jar</artifactId>
        <version>3.3.1</version>
    </dependency>
    <dependency>
        <groupId>jersey-bundle.jar</groupId>
        <artifactId>jersey-bundle.jar</artifactId>
        <version>1.18.1</version>
    </dependency>
    <dependency>
        <groupId>json.jar</groupId>
        <artifactId>json.jar</artifactId>
        <version>20140107</version>
    </dependency>
    <dependency>
        <groupId>jersey-core.jar</groupId>
        <artifactId>jersey-core.jar</artifactId>
        <version>1.18.1</version>
    </dependency>
    <dependency>
        <groupId>jersey-bundle</groupId>
        <artifactId>jersey-bundle</artifactId>
        <version>1.18.1</version>
    </dependency>
  </dependencies>
</project>

For every dependency the error is shown that

Missing artifact json.jar:json.jar:jar:20140107
Missing artifact asm.jar:asm.jar:jar:3.3.1
Missing artifact jersey-bundle.jar:jersey-bundle.jar:jar:1.18.1
Missing artifact jersey-bundle:jersey-bundle:jar:1.18.1
Missing artifact jersey-core.jar:jersey-core.jar:jar:1.18.1

Please help me to solve this.

Thanks!!

Upvotes: 3

Views: 43205

Answers (3)

Cuzz
Cuzz

Reputation: 448

in .m2 directory placed setting.xml, where your can declare repositories where dependecy jars should be find.

<settings>
 ...
 <profiles>
   ...
   <profile>
     <id>myprofile</id>
     <repositories>
       <repository>
         <id>my-repo2</id>
         <name>your custom repo</name>
         <url>http://jarsm2.dyndns.dk</url>
       </repository>
     </repositories>
   </profile>
   ...
 </profiles>

 <activeProfiles>
   <activeProfile>myprofile</activeProfile>
 </activeProfiles>
 ...
</settings>

and mirror example

  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository.
     | The repository that this mirror serves has an ID that matches the
     | mirrorOf element of this mirror. IDs are used for inheritance and direct
     | lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
  </mirrors>

for more information look here

Upvotes: 0

Robert Scholte
Robert Scholte

Reputation: 12345

You can use http://search.maven.org/ to find the right coordinates of the dependencies ( i.e groupId + artifactId + version ). If you have these jars already on your system, you can use http://search.maven.org/#advancedsearch%7Cgav SHA1 with checksum, and it'll give you the matching coordinates (if available in Maven Central of course).

Upvotes: 1

vincent
vincent

Reputation: 1244

you can't put the name of the jar directly. groupId refers to "packages" most of the time and artifactId to the name of the dependency. To have an example, go to http://mvnrepository.com/artifact/com.sun.jersey/jersey-core/1.18.3

Upvotes: 1

Related Questions