首先在jdk中的lib中放入tools.jar包
然后在pom.xml中引入
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.8.0</version>
<scope>system</scope>
<systemPath>C:/Program Files/Java/jdk1.8.0_45/lib/tools.jar</systemPath>
</dependency>