在pom.xml的dependicies標籤內加上一下內容
<!---設置JDK的環境 -->
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0_22</version>
<scope>system</scope>
<systemPath>C:/Program Files/Java/jdk1.6.0_19/lib/tools.jar</systemPath>
</dependency>