How to bundle JNLP API with Maven Project

Waldheinz picture Waldheinz · Jan 10, 2011 · Viewed 10.1k times · Source

I have a project where I need the JNLP API. I did not find an artifact for that on Maven Central, so I added an external Repository which offers that to my pom. That repository went offline this weekend. This is the second time something like this happened to me.

I know this is pretty much what Maven is not about, but really I just want that tiny jnlp-api-1.5.0.jar file to be

  1. In my SCM (I don't want to roll my own Maven repository for just one dependency).
  2. In the compile scope when the project builds.

Which knobs do I have to turn to accomplish this?

Answer

Jcs picture Jcs · Jan 10, 2011

As of JDK 7.0, the JNLP API is being provided by the javaws.jar file in your JRE's lib directory, i.e., ${java.home}/lib/javaws.jar. It is possible to use the maven dependency scope system.

<project>
  ...
  <dependencies>
    <dependency>
      <groupId>javax.jnlp</groupId>
      <artifactId>jnlp-api</artifactId>
      <version>7.0</version>
      <scope>system</scope>
      <systemPath>${java.home}/lib/javaws.jar</systemPath>
    </dependency>
  </dependencies>
  ...
</project>