使用Eclipse classpath变量来取代绝对的"源路径"路径? [英] Use Eclipse classpath variable to replace absolute "sourcepath" path?

查看:135
本文介绍了使用Eclipse classpath变量来取代绝对的"源路径"路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一个Eclipse classpath变量来解决附带的源JAR文件中的类路径库。这是Elcipse(靛蓝)我目前的的.classpath文件的内容:

I would like to use an Eclipse classpath variable to resolve the attached source JAR file for a library in my classpath. This is the contents of my current ".classpath" file in Elcipse (Indigo):

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src"/>
  <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry exported="true" kind="lib" path="lib/ApacheCommons/commons-logging.jar"/>
  <classpathentry exported="true" kind="lib" path="lib/Spring-WS/spring-ws-1.5.8-all.jar"/>

  <!-- [other entries] -->

  <classpathentry kind="output" path="bin"/>
</classpath>

当我现在添加源JAR文件弹簧WS-1.5.8-all.jar在中,的.classpath文件的内容是:

When I now add a source JAR file for "spring-ws-1.5.8-all.jar", the ".classpath" files contents is:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src"/>
  <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry exported="true" kind="lib" path="lib/ApacheCommons/commons-logging.jar"/>
  <classpathentry exported="true" kind="lib" path="lib/Spring-WS/spring-ws-1.5.8-all.jar"
    sourcepath="D:/dev/sources/spring-ws-1.5.8-sources.jar"/>

  <!-- [other entries] -->

  <classpathentry kind="output" path="bin"/>
</classpath>

如你所见,Eclipse的添加了源路径属性的classpathentry元素使用绝对路径。

As you can see, Eclipse added the "sourcepath" attribute to the "classpathentry" element with an absolute path.

现在我的想法是CLASSPATH变量SOURCE_PATH,这是正确的设置来取代绝对路径。D是:/ dev /来源

Now my idea is to replace the absolute path with the classpath variable "SOURCE_PATH", which is correctly set to "D:/dev/sources".

。(请不要问为什么我们有这个设置或建议,我们必须改变它,这是一个旧的项目,我们很遗憾没能/擅自改变构建结构)

(Please, don't ask why we have this setup or suggest we must change it; it is an old project and we are unfortunately not able/allowed to change the build structure).

我试过

sourcepath="SOURCE_PATH/spring-ws-1.5.8-sources.jar"

以及

sourcepath="${SOURCE_PATH}/spring-ws-1.5.8-sources.jar"

但两者的变种不工作。

but both variants do not work.

我看来,我要么使用了错误的语法,或者我不明白的类路径变量的概念。也许不能使用类路径变量为源路径属性

I seems, that I either use the wrong syntax or I don't understand the concept of classpath variables. Maybe the classpath variable can't be used for the "sourcepath" attribute?

非常感谢您的帮助!

推荐答案

我可能没有完全理解你的问题,但它听起来像你开始使用绝对路径添加您的jar文件。相反,与CLASSPATH变量添加。

I might not understand your question completely but it sounds like you added your jar file with an absolute path to begin with. Instead add it with a classpath variable.

使用项目属性,选择 Java构建路径选项。然后点击标签。然后添加变量.... 如果您尚未创建SOURCE_PATH CLASSPATH变量是,您可以通过点击配置变量从这里做。 .. 按钮(只是一个快捷方式到工作区的正确preference设置)。配置完成后,你应该看到在顶部的框中输入您的SOURCE_PATH类路径变量。您可以点击它延伸到扩展... 到一个子文件夹或jar文件。

Use the Project properties, select Java Build Path option. Then click on the Libraries tab. Then Add Variable.... If you haven't created your SOURCE_PATH classpath variable yet, you can do it from here by clicking the Configure Variables... button (just a shortcut to the proper workspace preference setting). Once configured you should see your SOURCE_PATH class path variable in the box at the top. You can click on it extend to Extend... it to a subfolder or a jar file.

这篇关于使用Eclipse classpath变量来取代绝对的&QUOT;源路径&QUOT;路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆