In jdk 1.7 for the Mac, the location of com.sun.tools.javah.Main moved from classes.jar to tools.jar. Consequently, Maven's maven-antrun-plugin cannot find the run the javah task and a ClassNotFound exception is thrown:
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javah.Main
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java :50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at org.apache.tools.ant.taskdefs.optional.javah.SunJavah.compile(SunJavah.java:57)
... 47 more
1.7 Location: /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/lib/tools.jar
1.6 Location: /Library/Java/JavaVirtualMachines/1.6.0_32-b05-420.jdk/Contents/Classes/classes.jar
This seems like a bug or failure of maven version 3.0.4. I considered making tools.jar a plugin dependency, but that just doesn't seem right. I tried these solutions, but I couldn't get them to work:
JDK tools.jar as maven dependency
maven: How to load tools.jar/classes.jar in an OS independent way?
Any work around until the maven folks address the maven-antrun-plugin with jdk-1.7 on mac?