maven工程有报错如下:
Invalid classpath publish/export dependency D:/myeclipse/Common/binary/com.sun.java.jdk.win32.x86_64_1.6.0.013/lib/tools.jar. The project contains another dependency with the same archive name.buildingProject P/buildingProjectClasspath Dependency Validator Message
经过排查后 是 .classpath中的路径定义有问题 即同一路径下已经存在 同名的构件
我们可以修改路径 或者 在pom.xml中把它排除
排除
<!-- <dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<version>1.6</version>
<scope>system</scope>
<systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency> -->
路径修改
原.classpath文件如下:
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="resource"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <attributes> <attribute name="org.eclipse.jst.component.dependency" value="WebRoot/WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/> </classpath>
修改如下后问题解决:
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="src" path="resource"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <attributes> <attribute name="org.eclipse.jst.component.dependency" value="WEB-INF/lib"/> </attributes> </classpathentry> <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/> </classpath>