这是我的.classpath文件,在我添加了两个外部jar(org.restlet.ext.simple.jar和org.simpleframework.jar)之后:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="lib" path="../3rd_party/restlet-jse-2.0.10/lib/org.restlet.ext.jackson.jar" sourcepath="C:/Program Files/Java/restlet-jse-2.0.10/src">
<attributes>
<attribute name="javadoc_location" value="file:/C:/Program Files/Java/restlet-jse-2.0.10/docs/ext/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../3rd_party/restlet-jse-2.0.10/lib/org.restlet.ext.ssl.jar" sourcepath="C:/Program Files/Java/restlet-jse-2.0.10/src">
<attributes>
<attribute name="javadoc_location" value="file:/C:/Program Files/Java/restlet-jse-2.0.10/docs/ext/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../3rd_party/restlet-jse-2.0.10/lib/org.restlet.jar" sourcepath="C:/Program Files/Java/restlet-jse-2.0.10/src">
<attributes>
<attribute name="javadoc_location" value="file:/C:/Program Files/Java/restlet-jse-2.0.10/docs/api"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="../3rd_party/restlet-jse-2.0.10/lib/org.jsslutils_1.0/org.jsslutils.jar"/>
<classpathentry kind="lib" path="../3rd_party/restlet-jse-2.0.10/lib/org.codehaus.jackson_1.4/org.codehaus.jackson.core.jar"/>
<classpathentry kind="lib" path="../3rd_party/restlet-jse-2.0.10/lib/org.codehaus.jackson_1.4/org.codehaus.jackson.mapper.jar"/>
<classpathentry kind="lib" path="../3rd_party/guice-3.0/aopalliance.jar"/>
<classpathentry kind="lib" path="../3rd_party/guice-3.0/guice-3.0.jar"/>
<classpathentry kind="lib" path="../3rd_party/guice-3.0/javax.inject.jar"/>
<classpathentry kind="lib" path="C:/dev/poc/3rd_party/restlet-jse-2.0.10/lib/org.restlet.ext.simple.jar" sourcepath="C:/Program Files/Java/restlet-jse-2.0.10/src">
<attributes>
<attribute name="javadoc_location" value="file:/C:/Program Files/Java/restlet-jse-2.0.10/docs/ext/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/dev/poc/3rd_party/restlet-jse-2.0.10/lib/org.simpleframework_4.1/org.simpleframework.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Run Code Online (Sandbox Code Playgroud)
请注意,它们已添加了绝对路径,与其他具有相对路径的条目不同,但仅因为我每次添加新的外部jar时手动编辑此文件.
我的问题是,我可以告诉Eclipse使用新添加的外部罐子的相对路径吗?
谢谢.
Mat*_*ell 20
一种解决方案是不使用外部罐子,而是将您的罐子放入项目中,然后使用Add Jar(s)而不是Add External Jar(s).
从源代码控制的角度来看,这是有道理的,您可以根据需要添加/删除依赖项.这也意味着当你为一个单独的项目更新一个jar时,它不会影响这个.
我们过去做过这个,我们有一个包含所有jar的项目,这些jar在其他项目的构建路径中被引用.
但现在我们使用maven,所以我们不再需要这样做了.