Search code examples
mavenjxbrowser

jxbrowser-cross-platform dependency fails to install


I have followed these instructions. I'm able to successfully do mvn install if I add a platform specific dependency:

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-linux64</artifactId>
  <version>6.2</version>
</dependency>

But if I use dependency :

<dependency>
  <groupId>com.teamdev.jxbrowser</groupId>
  <artifactId>jxbrowser-cross-platform</artifactId>
  <version>6.2</version>
</dependency>

On running mvn install, it does download jar files for each platform but in the end gives following error:

Failure to find com.teamdev.jxbrowser:jxbrowser-cross-platform:jar:6.2

Under the .m2 directory, I do see jar files for individual platforms in their respective folders and there is no jar file under the jxbrowser-cross-platform folder.

I was able to find a workaround by adding dependency for each platform individually. Is there anything I'm missing here ?


Solution

  • You need to add a reference to the TeamDev repository for this dependency, since it is not available in Maven Central. From the instructions:

    In order to obtain JxBrowser JAR files using Maven you need to add TeamDev's Maven repository to the repositories section of your pom.xml file:

    <repository>
        <id>com.teamdev</id>
        <url>http://maven.teamdev.com/repository/products</url>
    </repository>
    

    Then, you can add the cross platform dependency, which is present in that repo:

    <dependency>
        <groupId>com.teamdev.jxbrowser</groupId>
        <artifactId>jxbrowser-cross-platform</artifactId>
        <version>6.2</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
    

    Note the addition of the <type> and <scope> that are not present in the instructions, this explains your error. Maven is, by default, looking for a JAR but there is no JAR, only a POM for this dependency, so we import the dependencies.