0

I have a dependency problem with maven. I used to have saxon 8.7 that is located on maven central. Then, I had to upgrade to the latests saxon-b 9.1.0.0 which is only partially on maven central.

This is a snippet of my dependencies:

    <dependency>
        <groupId>net.sourceforge.saxon</groupId>
        <artifactId>saxon</artifactId>
        <version>9.1.0.8</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.saxon</groupId>
        <artifactId>saxon-dom</artifactId>
        <version>9.1.0.8</version>
        <scope>runtime</scope>
    </dependency>

The first artifact 'saxon' is available on maven central, but the secon 'saxon-dom'. Here is the artifact I want.

Can I tell maven to download the "jar" file or am I obliged to download the jar and publish it locally on my maven repo to use it as a dependency?

code-gijoe
  • 6,949
  • 14
  • 67
  • 103

2 Answers2

3

Did not expect to resolve this so easily :

<dependency>
  <groupId>net.sourceforge.saxon</groupId>
  <artifactId>saxon</artifactId>
  <version>9.1.0.8</version>
  <classifier>dom</classifier>
</dependency>

Basically, I can get the dependencies that are "attached" to the 'saxon' artifact using the classifier tag. Did not know about this and I found out that the tag existed when I searched for 'saxon' on Sonatype repository (which is quite good). It gave me the dependency snippet above.

Reference : http://maven.apache.org/pom.html

code-gijoe
  • 6,949
  • 14
  • 67
  • 103
  • I am confused a little bit. Check this [search](https://repository.sonatype.org/index.html#nexus-search;quick~saxon-dom), it is this that the OP needs. And the link you gave doesn't shown any pom snippet with the classifier. – mtk Dec 06 '12 at 18:03
  • I gave the snippet, I only gave the maven POM full reference. All the jars are named "saxon-x.jar", I only added the to tell maven to use it as a "name". So in the example above, it becomes "saxon-dom.jar". This way I got maven to download the jar files that are part of the the main "saxon" artifact. – code-gijoe Dec 06 '12 at 23:53
1

If the required version is not in the repo, then yes you need to do one of the following alternatives

  1. Search for a public repo containing the required version of jar. And add the repo to your pom.xml file. OR

  2. Download it manually, and install it locally on your machine, to help the project build completely.

mtk
  • 13,221
  • 16
  • 72
  • 112