解決:eclipse或STS運行maven工程出現Missing artifact jdk.tools:jdk.tools:jar:1.7問題

來源:互聯網
上載者:User

標籤:jre   apache   lips   png   啟動   方法   div   isp   base   

eclipse或STS運行maven工程出現Missing artifact jdk.tools:jdk.tools:jar:1.7問題

  最近項目中使用到大資料平台,代碼中應用了hbase-client.0.98.6-hadoop2.jar包,該包中引用了jdk.tools.1.7,所以導致eclipse中pom.xml老是提示Missing artifact jdk.tools:jdk.tools:jar:1.7。從網上找了一下原因大多都說是工程maven找不到系統內的jdk1.7,根本原因是沒有指定javaw.exe的的位置導致的,具體解決方案有三種,這裡我偏向第一種,因為第二和第三種都改改動pom.xml檔案,這樣並不好,因為我們再開發中工程代碼有多個人共同開發,你改動pom檔案可能會影響別人,所以pom盡量有一個人管理,盡量少帶動別人的代碼。

方法一:修改eclipse或STS啟動配置

      找到eclipse或STS的安裝路徑,在安裝路徑下找到eclipse.ini或STS.ini,將其檔案開啟,在檔案中找到“-vmargs”,在“-vmargs”之前添加下面代碼

-vmD:\tools\java\jdk1.7\jre\bin\server\jvm.dll

     其中 D:\tools\java\jdk1.7 替換成自己的JAVA_HOME路徑記錄。

     修改之後重啟eclipse或STS即可

方法二:直接在pom.xml中加上一個依賴項目

    在pom檔案中添加下面配置

<dependency>      <groupId>jdk.tools</groupId>      <artifactId>jdk.tools</artifactId>      <version>1.7</version>      <scope>system</scope>      <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>  </dependency>  
方法三:在pom檔案的plugins中指定jdk

    在maven工程的pom檔案中添加如下配置

<plugins>    <plugin>        <groupId>org.apache.maven.plugins</groupId>        <artifactId>maven-compiler-plugin</artifactId>        <configuration>            <source>1.7</source>            <target>1.7</target>        </configuration>    </plugin></plugins>

 

解決:eclipse或STS運行maven工程出現Missing artifact jdk.tools:jdk.tools:jar:1.7問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.