Search
Calendar
March 2024
S M T W T F S
« Sep    
 12
3456789
10111213141516
17181920212223
24252627282930
31  
Your widget title
Archives

Posts Tagged ‘Sun’

PostHeaderIcon How to include a dependency to tools.jar in Maven?

Case

You need include tools.jar as a dependency in a pom.xml, for instance in order to use Java 5’s annotations and APT. From a “Maven’s view point”, tools.jar is not a regular JAR defined by a groupId and artefactId.

Solution

Add this block in your pom.xml:

<dependency>
    <groupId>com.sun</groupId>
    <artifactId>tools</artifactId>
    <version>1.6.0_24</version>
    <scope>system</scope>
    <systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>

(You can also add it in your settings.xml)

You can do the same for any other “non-regular” JAR, available in your file system.