3

jung2 is in maven repository, here and here.

But my Eclipse does not finding it out:

enter image description here

Code is here:

<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>tests.jung</groupId>
    <artifactId>TryJung</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <dependencies>

        <dependency>
            <groupId>net.sf.jung</groupId>
            <artifactId>jung2</artifactId>
            <version>2.0</version>
        </dependency>



    </dependencies>
</project>

UPDATE

Sorry can't accept answers about dependency type, because it is not complete. The code for jung dependency was taken from Maven repository directly:

enter image description here

So, I need an explanation, why doesn't code, taken from repository site, work actually.

What is happening here, who is "guilty"?

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
  • The problem is simply the artifact you are adressing is a [pom file](http://search.maven.org/#artifactdetails%7Cnet.sf.jung%7Cjung2%7C2.0%7Cpom) and not a jar file. That's the reason for the message. – khmarbaise Jan 27 '15 at 16:37

3 Answers3

2

As already said, you are addressing a pom file. Which is, in a sense, correct, but if you want to compile you will need to add the actual jars in the dependencies section, such as:

<dependencies>

    <dependency>
        <groupId>net.sf.jung</groupId>
        <artifactId>jung2</artifactId>
        <version>${jung.version}</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>net.sf.jung</groupId>
        <artifactId>jung-api</artifactId>
        <version>${jung.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.jung</groupId>
        <artifactId>jung-visualization</artifactId>
        <version>${jung.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.jung</groupId>
        <artifactId>jung-graph-impl</artifactId>
        <version>${jung.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.jung</groupId>
        <artifactId>jung-algorithms</artifactId>
        <version>${jung.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>net.sf.jung</groupId>
        <artifactId>jung-io</artifactId>
        <version>${jung.version}</version>
        <scope>compile</scope>
    </dependency>

</dependencies>

Do not forget to define the version property also in the properties section:

<properties>
    <jung.version>2.0.1</jung.version>
</properties>

Hope this helps.

Bruno Bossola
  • 1,128
  • 1
  • 13
  • 24
1

The problem is simply the artifact you are adressing is a pom file and not a jar file. That's the reason for the message.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • Why isn't it writing "incorrect artifact type", but writes "artifact not found"? – Suzan Cioc Jan 28 '15 at 09:59
  • The artifact type is by default `jar` so that's the problem which means you need to understand Maven's defaults for dependencies. – khmarbaise Jan 28 '15 at 10:12
  • The creators of `mvnrepository.com` site need to understand this. They probably don't know maven default dependency, since they give pom dependency without pom entry, see my update. – Suzan Cioc Jan 28 '15 at 13:05
0

just stumbled into the same problem pit. apparently these are pom files purely for building/documenting (all) sub-projects (or submodules in maven speak) of a project (in this case jung2)

they can't be used as a dependency in a useful way

actually you can depend on them with <type>pom</type> but will just include the dependencies of that pom but not it's modules.

see here for a more complete explanation: How to use POMs as a dependency in Maven?

Community
  • 1
  • 1
bernstein
  • 386
  • 1
  • 10