gpt4 book ai didi

java - 有没有办法让 "Relative Path"成为在 netbeans 中添加 JAR 文件的默认值?

转载 作者:行者123 更新时间:2023-12-02 07:29:45 26 4
gpt4 key购买 nike

在netbeans中,如果右键单击一个项目,转到Properties,然后单击Libraries,它会显示添加到项目中的当前JAR文件的列表。然后,您可以通过单击添加 JAR/文件夹 添加更多库。但是,当您单击 JAR 文件时,它默认为绝对路径。在我的特定情况下,这绝不是我想要的,我经常只是点击打开并错误地添加文件。当我检查我的项目更改为 SVN 时,绝对路径破坏了我所有团队成员的构建。

那么,有没有办法让相对路径成为默认路径?

更新:澄清一下,我在 netbeans 中打开了多个项目。

Main -/lib/包含我的所有 JAR 文件。 Main指的是lib文件夹中的一些JAR文件,按照描述添加JAR文件默认使用相对路径

PluginA - 使用并引用 Main/lib 内的一些 JAR 文件。我按照描述添加 JAR 文件,它们默认为绝对路径。我希望这些默认使用相对路径

最佳答案

可悲的是,我怀疑 this bug 的存在意味着答案是无法将相对路径设置为默认路径。

寻找替代品:在同一个错误中有 this description of NB behaviour :

  1. If the JAR is considered "collocated" with the project basedir according to some provider of this information (generally a version control system which checks whether file paths are in the same checkout), then Relative is checked by default. (Since it can be assured that someone else checking out the same sources would indeed be able to use the same path.)

  2. If the JAR can be referred to using a named variable, that is used.

因此,如果项目位于同一个 SVN 存储库中,使用单个工作副本(直到最近我才这样做,以及为什么我从未注意到绝对/相对问题)可以工作。

否则,为该 /lib 目录定义一个变量可能是一种解决方法。

关于java - 有没有办法让 "Relative Path"成为在 netbeans 中添加 JAR 文件的默认值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13071313/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com