0

'.classpath' 文件上的某个 'svn diff' 给了我以下输出。我看不出工作副本 (+) 和原始副本 (-) 之间有什么区别(是吗?)。问题是我没有更改这些文件(即我没有尝试更改项目的构建路径)但它们似乎在构建过程中被修改。我使用 STS 3.3.0.RELEASE,没有 'svn' 插件。我确实使用 Maven 插件进行 Eclipse 构建。

如果它们不受影响,那就太好了。有没有办法,我可以确保这一点?另一方面,如果我的“.classpath”文件没有被修改,那么为什么“svn diff”会给我这个输出?

谢谢。

@@ -1,29 +1,29 @@
-<?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 including="**/*.java" kind="src" path="src/main/resources"/>
-   <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-   <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 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"/>
-           <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
-       </attributes>
-   </classpathentry>
-   <classpathentry kind="output" path="target/classes"/>
-</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 including="**/*.java" kind="src" path="src/main/resources"/>
+   <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+   <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 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"/>
+           <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
+       </attributes>
+   </classpathentry>
+   <classpathentry kind="output" path="target/classes"/>
+</classpath>
4

1 回答 1

1

@JimLewis 和其他人在问题下方的评论中提出的怀疑确实是真的。将所述命令的输出保存到文件中并cat -v对该文件执行操作会产生以下输出:

@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>^M
-<classpath>^M
-   <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>^M
-   <classpathentry kind="src" output="target/classes" path="src/main/java">^M
-       <attributes>^M
-           <attribute name="optional" value="true"/>^M
-           <attribute name="maven.pomderived" value="true"/>^M
-       </attributes>^M
-   </classpathentry>^M
-   <classpathentry kind="src" output="target/test-classes" path="src/test/java">^M
-       <attributes>^M
-           <attribute name="optional" value="true"/>^M
-           <attribute name="maven.pomderived" value="true"/>^M
-       </attributes>^M
-   </classpathentry>^M
-   <classpathentry kind="src" path="src/main/resources"/>^M
-   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.io"/>^M
-   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.config"/>^M
-   <classpathentry exported="true" kind="lib" path="jars-not-in-maven-repo/eventful.jar"/>^M
-   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.nlp"/>^M
-   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.attrs"/>^M
-   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">^M
-       <attributes>^M
-           <attribute name="maven.pomderived" value="true"/>^M
-       </attributes>^M
-   </classpathentry>^M
-   <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">^M
-       <attributes>^M
-           <attribute name="maven.pomderived" value="true"/>^M
-           <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>^M
-       </attributes>^M
-   </classpathentry>^M
-   <classpathentry kind="output" path="target/classes"/>^M
-</classpath>^M
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+   <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+   <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="src" output="target/test-classes" path="src/test/java">
+       <attributes>
+           <attribute name="optional" value="true"/>
+           <attribute name="maven.pomderived" value="true"/>
+       </attributes>
+   </classpathentry>
+   <classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
+   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.io"/>
+   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.config"/>
+   <classpathentry exported="true" kind="lib" path="jars-not-in-maven-repo/eventful.jar"/>
+   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.nlp"/>
+   <classpathentry combineaccessrules="false" kind="src" path="/net.holisticlabs.libs.attrs"/>
+   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+       <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"/>
+           <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
+       </attributes>
+   </classpathentry>
+   <classpathentry kind="output" path="target/classes"/>
+</classpath>

原始的“.classpath”是在 Windows 机器上生成的,它使用 CRLF 换行符,而我的 unix 机器上的 maven 用 LF 换行符替换了它们。正如还建议的那样,svn:ignore'svn revert'可用于处理此类情况。

于 2013-11-07T02:54:14.450 回答