Building Struts 2 on Mac OS X with Maven using mvn install

When trying to build Struts 2 on Mac OS X (I'm using 10.4.8) you might get an error like:
 class="codeContent" class="codeContent"[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

1) com.sun:tools:jar:1.5.0

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun -DartifactId=tools \
          -Dversion=1.5.0 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) org.apache.struts:struts2-core:jar:2.0.3-SNAPSHOT
        2) org.apache.struts:struts-annotations:jar:1.0-SNAPSHOT
        3) com.sun:tools:jar:1.5.0

1 required artifact is missing.

for artifact:

from the specified remote repositories:
  Maven Snapshots (,
  central (,
  opensymphony (,
  apache.snapshots (,
  snapshots-maven-codehaus (
The problem is that there is no tools.jar on Mac OS X. The analog for tools.jar on Mac OS X is classes.jar. A quick fix to allow the build to continue is to change the sun.jdk dependency in a pom.xml. For this, I edited the
located in
 class="codeContent"    <dependency>
      <!-- This line doesn't work on a Mac: <systemPath>${java.home}/../lib/tools.jar</systemPath> -->


Troubleshooting and other Tips


If you are getting OutOfMemoryError exceptions when attempting a full build of Mule you may try increasing the max heap and the PermGen space sizes. Either export a MAVEN_OPTS variable in your shell or add it to the original mvn script.

 class="codeContent"MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=256m

or edit your bash shell

export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m"


Popular Posts