sunh
sunh

Reputation: 84

About dependency in maven

I have some code, its depend org.apache.batik.*. Many jars are necessary.I tried import this im my pom.xml.

    <dependency>
        <groupId>org.apache.batik</groupId>
        <artifactId>org.apache.batik</artifactId>
        <version>1.6.0-20070705</version>
    </dependency>

So, That I found all jars I need have entered in project libraries.Following this. enter image description here

Inside this jar that has a lib folder, That all jars I need are in there. The problem is my code seems can not find some jar they need. enter image description here

I can't sure if cause is the jar that I imported has a lib folder, and I found other maven jar's structure doesn't like this. So thank if you can help me!

EDIT 1
I imported this successful, this dependency's type is 'pom', so I think my
code should can find those dependency they need, but in fact, it didn't work. I don't know why.

        <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>batik</artifactId>
        <version>1.10</version>
        <type>pom</type>
    </dependency>

enter image description here

Upvotes: 1

Views: 2715

Answers (2)

Alf
Alf

Reputation: 2321

The artifact you are using is not directly usable in maven.

If you can use a more recent version (1.9, 1.10) of batik you can try this:

<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>batik-all</artifactId>
    <version>1.9</version>
    <type>pom</type>
</dependency>

If not search on https://mvnrepository.com/artifact/batik

In the latter case it seems you need to add each dependency one by one

Upvotes: 2

J Fabian Meier
J Fabian Meier

Reputation: 35903

  1. Define dependencies for all jars you use in your source code. This usually means all jars from which you import at least one class in your source code.

  2. Run clean package with Maven.

  3. If you have errors, check if dependencies are missing.

  4. If you get stuck, try a new question on Stackoverflow.

Upvotes: 0

Related Questions