简体   繁体   English

Netbeans 12 与 Ant 如何更改默认 lib 文件夹

[英]Netbeans 12 with Ant how to change default lib folder

I'm using Netbeans 12 with Ant to build my apps.我正在使用 Netbeans 12 和 Ant 来构建我的应用程序。 The default folder for libraries is 'lib'.库的默认文件夹是“lib”。 Is there any simple and straightforward way to change it?有没有简单直接的方法来改变它? For example I need to put my libraries in the same folder together with my main.jar when building.例如,我需要在构建时将我的库与我的 main.jar 放在同一个文件夹中。

I've checked some older related questions here, but answers were either too complicated or not actual anymore (provided links not working etc.)我在这里检查了一些较旧的相关问题,但答案要么太复杂,要么不再实际(提供的链接不起作用等)

Using the NetBeans Project Wizard, select File > New Project > Java with Ant > Java Application , and click Next> . Using the NetBeans Project Wizard, select File > New Project > Java with Ant > Java Application , and click Next> .

The wizard screen will include a checkbox labeled Use Dedicated Folder for Storing Libraries .向导屏幕将包括一个标记为Use Dedicated Folder for Storing Libraries的复选框。 To change the default folder for libraries check that box, and then the following field labelled Libraries Folder will become enabled.要更改库的默认文件夹,请选中该框,然后将启用以下标记为库文件夹的字段。 You can replace the default value of .\lib with your own directory.您可以将.\lib的默认值替换为您自己的目录。 For example:例如:

非默认 lib 文件夹

You can use the same approach when creating web applications and enterprise applications.在创建 web 应用程序和企业应用程序时,您可以使用相同的方法。 The field settings are sticky, so be sure to check that the values remain appropriate when creating subsequent projects.字段设置具有粘性,因此请务必在创建后续项目时检查这些值是否保持适当。

I couldn't find any NetBeans 12 documentation on this, but the NetBeans 8.2 documentation remains valid.我找不到任何 NetBeans 12 文档,但 NetBeans 8.2 文档仍然有效。 See section 6.6 Sharing a Library with Other Users for details:有关详细信息,请参阅第 6.6 节与其他用户共享库

You can configure most standard Java SE, Web, and Enterprise projects in a way that makes it easy to share libraries with other users.您可以配置大多数标准 Java SE、Web 和企业项目,以便与其他用户轻松共享库。 You can specify a location for libraries on which the project relies.您可以为项目所依赖的库指定位置。 You can also specify how the libraries are referenced from your project...您还可以指定如何从项目中引用库...

Note that this approach will not put (what you called) main.jar in the specified libraries folder.请注意,这种方法不会将(您所谓的) main.jar放在指定的库文件夹中。 That will still be placed directly under the dist directory.那仍将直接放在dist目录下。 If you want to change that behavior I think you might need to modify some NetBeans Ant script(s).如果你想改变这种行为,我想你可能需要修改一些 NetBeans Ant 脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM