Ivy - Can't download because POM file and the JAR file name aren't matching patterns
Asked Answered
B

1

2

me again with IVY.

The problem now is that the ivy file the POM file to the JSON library is called:

http://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.4/json-lib-2.4.pom

json-lib-2.4.pom

But the JAR file is called:

json-lib-2.4-jdk13.jar

The -jdk13 makes it so that the pom file cannot be found.

Ergo it can't download the JAR file because it says this:

== resolving dependencies egencia#com.egencia.test.framework;working@ESFVMVI-750->net.sf.json-lib#json-lib;2.4 [default->compile]
[ivy:resolve]       tried http://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk13.jar
[ivy:resolve]   maven: no ivy file found for net.sf.json-lib#json-lib;2.4: using default data
[ivy:resolve]   found net.sf.json-lib#json-lib;2.4 in maven

Now.. I managed to put a pattern in which finds the JAR file, adding the -jdk13 to it.. But this way the POM file is no longer found.

After that, there is no downloaded JAR file and of course the build failes because of the missing dep.

So... can I somehow configure the POM to be something else as the JAR files name?

THANKS!!

Bemoan answered 4/8, 2011 at 14:13 Comment(1)
Hannibal, how did the provided answer work for you? Any comments?Benson
B
7

It's called a classifier attribute in Maven. Try declaring your dependency as follows:

<ivy-module version='2.0' xmlns:m="http://ant.apache.org/ivy/maven">
    ..
    <dependencies>
        ..
        <dependency org="net.sf.json-lib" name="json-lib" rev="2.4"> 
            <artifact name="json-lib" type="jar" m:classifier="jdk13"/>
        </dependency>
        ..
    </dependencies>
</ivy-module>

This will retrieve the associated artifact rather than the default primary artifact from the Maven module.

Update

This ivy dependency declaration is functionally the same as the following in Maven

<dependency>
  <groupId>net.sf.json-lib</groupId>
  <artifactId>json-lib</artifactId>
  <version>2.4</version>
  <classifier>jdk13</classifier>
</dependency>
Balliett answered 4/8, 2011 at 23:20 Comment(1)
Slight update to the above answer. The classifier annotation changed to maven:classifierPeursem

© 2022 - 2024 — McMap. All rights reserved.