macx操作系統下maven tools.jar問題解決辦法

 

 本文轉自:http://wenshao.iteye.com/blog/986658

 

首先聲明,這不是原創,貼在這裏只爲了方便我和我的朋友們以後查詢方便。 

MacX中的JDK和Oracle JDK(原來SUN JDK)提供的實現有很大不同,其中一個就是沒有tools.jar,在classes.jar中已經包括了Oracle JDK tools.jar中的內容。 

曾想過更簡單的辦法,但是沒試驗成功,就不列在這裏了。 

 

<profiles>
    <profile>
        <id>default-profile</id>
        <activation>
            <activeByDefault>true</activeByDefault>
            <file>
                <exists>${java.home}/../lib/tools.jar</exists>
            </file>
        </activation>
        <properties>
            <toolsjar>${java.home}/../lib/tools.jar</toolsjar>
        </properties>
    </profile>
    <profile>
        <id>mac-profile</id>
        <activation>
            <activeByDefault>false</activeByDefault>
            <file>
                <exists>${java.home}/../Classes/classes.jar</exists>
            </file>
        </activation>
        <properties>
            <toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
        </properties>
    </profile>
</profiles>

<dependencies>
	<dependency>
		<groupId>com.sun</groupId>
		<artifactId>tools</artifactId>
		<version>1.6.0</version>
		<scope>system</scope>
		<systemPath>${toolsjar}</systemPath>
	</dependency>

</dependencies>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章