AdSense

網頁

2019/2/10

Eclipse 專案執行Maven Update後出現Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result警告

在Eclipse的Maven專案執行Maven Update出現警告如下:

Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported or published. Runtime ClassNotFoundExceptions may result

pom.xml<package>jar,則每次執行Maven Update後,Eclipse專案的.classpath檔中的以下內容會由原本的

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
 <attributes>
  <attribute name="maven.pomderived" value="true"/>
  <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
 </attributes>
</classpathentry>

變成下面,少了
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>

<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
 <attributes>
  <attribute name="maven.pomderived" value="true"/>
 </attributes>
</classpathentry>

因為若打包成jar,Eclipse m2e就不會將依賴的jar(Maven dependencies)設為deploy path。


解決方法是將Maven Dependency的Deploy Path設為WEB/lib

在Eclipse專案上點滑鼠右鍵 -> Properties -> Deployment Assembly -> 點選Add... -> Java Build Path Entries -> Maven Dependencies -> Finish



參考:

沒有留言:

AdSense