1. 程式人生 > >import專案找不到maven 依賴包的處理方法

import專案找不到maven 依賴包的處理方法

如下圖:


方法一:

專案右鍵-maven-disable maven nature。

專案右鍵-configure-convert to maven project。

注:此方法多數情況可以,但是特殊情況也處理不了,則採取第二種終極方法。

方法二:

在專案根目錄下找到.classpath檔案,加入程式碼之後如下:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
............................................

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>