Install Sun Jar Files

Most of Sun Java libraries are not available in the default Maven repository due to limitations of the Sun’s Binary License.

If you come across this (e.g. JMS, JavaMail, JTA) then you are required to install manually those artifacts. To install the jar file into your Local Repository use:

mvn install:install-file -DgroupId=javax.jms -DartifactId=jms -Dversion=1.1
  -Dpackaging=jar -Dfile=C:/jms.jar

Alternatively, if you have an Internal Repository running on your company intranet, you can deploy (mvn deploy:deploy-file..) the Sun jar files on this.

Using Java.net

Java.net provides a Maven 2 repository which you can configure in your POM or settings.xml:

<project>
...
   <repositories>
        <repository>
          <id>maven2-repository.dev.java.net</id>
          <name>Java.net Repository for Maven</name>
          <url>http://download.java.net/maven/2/</url>
          <layout>default</layout>
        </repository>
   </repositories>
...
</project>

Refer to the Maven Guide to Sun JARs for more information.

Leave a comment