Martin Koster
Martin Koster

Reputation: 21

Add jnetpcap to maven fails

I try to add jnetpcap as a dependency to maven. I found on the internet the following that should be added to the pom file:

<dependency>
    <groupId>jnetpcap</groupId>
    <artifactId>jnetpcap</artifactId>
    <version>1.4.r1425-1g</version>
</dependency>

I tried this with multiple version numbers, but maven can't find the version:

Dependency 'jnetpcap:jnetpcap:1.4.r1425-1g' not found (the version is colored red).,

Also I tried to add the library via the project structure in IntelliJ. The Maven repository can find the jnetpcap library but when I try to import it i get:

No files were downloaded for jnetpcap:jnetpcap:1.4.r1425-1g.

The library can be manually imported via the jnetpcap.jar file but I need it as a maven dependency in my pom for creating a jar file of my project. Otherwise I get a jar file which can't execute since it is missing the dependency.

Does somebody know how I can include the dependency or otherwise how I can create a jar file of my project without missing this dependency?

Upvotes: 1

Views: 1822

Answers (2)

JMax
JMax

Reputation: 1202

The artifact is correct, however you are missing one little detail which is obvious, looking at the info page at mvnrepository.com:

https://mvnrepository.com/artifact/jnetpcap/jnetpcap/1.4.r1425-1g

Especially look at the table line Repositories. There you will see that this artifact is only listed in the "Clojars" repository, a non-standard repository you most likely have not added to your project.

Therefore adding the dependency is not enough, you also have to add the following section:

<repositories>
  <repository>
    <id>Clojars</id>
    <name>Clojars</name>
    <url>https://clojars.org/repo/</url>
  </repository>
</repositories>

Upvotes: 5

fmatar
fmatar

Reputation: 3470

The version of the jar you are requesting is not published to the maven repository.

This would work

<dependency>
    <groupId>jnetpcap</groupId>
    <artifactId>jnetpcap</artifactId>
    <version>1.4.r1425-1g</version>
</dependency>

Upvotes: 0

Related Questions