This is something that I’ve done before, but forgot to document, and had to look it up again when setting up my home computer for some development with Maven.
The Maven Central Repo may or may not contain all the libraries you need when building. Common missing libraries may include:
- com.sun.jdmk:jmxtools:jar:1.2.1
- com.sun.jmx:jmxri:jar:1.2.1
- javax.jms:jms:jar:1.1
A quick way to fix this up is to add some more repositories to Maven.
You can add the repositories to either your project POM, your user settings.xml, or global settings.xml
<profile>
<id>extra-repos</id>
<repositories>
<repository>
<id>jboss-repository</id>
<name>JBoss Deprecated Maven Repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
<layout>default</layout>
<releases><enabled>true</enabled><updatePolicy>never</updatePolicy></releases>
<snapshots><enabled>false</enabled><updatePolicy>never</updatePolicy></snapshots>
</repository>
<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>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>https://repository.jboss.org/</url>
<layout>default</layout>
</repository>
</repositories>
</profile>
After that, you can make sure this profile is always enabled by also adding it to your active profiles in your settings.xml
<activeProfiles>
<activeProfile>extra-repos</activeProfile>
</activeProfiles>
Once you’ve added these additional repositories, you might also have to manually install some libraries. I ran into this problem with jmxtools.jar 1.2.1 and jmxri.jar 1.2.1. These have to be downloaded from Oracle; the jmx libraries I was looking for were found under jmx 1.2.1.
After downloading the libraries, you simply have to install them to your own repository. If you’re just using a local repository, it’s as simple as
mvn install:install-file -Dfile=jmxri.jar -DgroupId=com.sun.jmx -DartifactId=jmxri -Dversion=1.2.1 -Dpackaging=jar mvn install:install-file -Dfile=jmxtools.jar -DgroupId=com.sun.jdmk -DartifactId=jmxtools -Dversion=1.2.1 -Dpackaging=jar