1、这两天遇到了个问题就是导入maven工程的时候所有的依赖包下载不下来,最后而且在工程的buildPath====>java BuildPath====>libraries 中没有maven Dependencies,这显得maven项目很奇怪,最后经过查找问题,发现在你本地的工程目录中的.classPath是有问题的,这个文件是决定工程目录结构的
将.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>
加上 将工程clean后就发现在libraries 有maven Dependencies显示了。
2、对于这个.classPath文件里面内容的解析
定义项目的结构,如src、output、con、lib等。
源文件的具体位置(kind="src")
运行的系统环境(kind="con")
工程的library的具体位置信息(kind="lib")
在每个lib的xml子节点中,有关于它的其它配置信息(例如我配置的那个"javadoc_location")
项目的输出目录(kind="output")
样本:
<?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 excluding=
"**"
kind=
"src"
output=
"target/classes"
path=
"src/main/resources"
>
<attributes>
<attribute name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry kind=
"src"
output=
"target/test-classes"
path=
"src/test/java"
>
<attributes>
<attribute name=
"optional"
value=
"true"
/>
<attribute name=
"maven.pomderived"
value=
"true"
/>
</attributes>
</classpathentry>
<classpathentry excluding=
"**"
kind=
"src"
output=
"target/test-classes"
path=
"src/test/resources"
>
<attributes>
<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.6"
>
<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>