简体   繁体   English

如何设置Github和Netbeans添加库?

[英]How to setup Github and Netbeans to add libraries?

What I want is: 我想要的是:

When someone pushes to a Github repository the Netbeans project would include the Libraries of my project, so that the people who will work in the project wouldn't have to download the libraries form anywhere else, how could I do that? 当有人推送到Github存储库时,Netbeans项目将包括我项目的库,这样,在项目中工作的人就不必下载其他地方的库表格了,我该怎么办?

I also would like to know if when adding a global library to my project it grabs a copy of the library or it's just a reference? 我还想知道,当在我的项目中添加全局库时,它是获取库的副本还是仅仅是参考?

Is there any other approach that I'm not considering? 还有我没有考虑的其他方法吗? I know about Gradle and Maven, but I just don't want to use them right now. 我了解Gradle和Maven,但我现在不想使用它们。

Well, the only way you would do this would be to include a 'lib' folder in your project, and include added files in your commits. 好吧,唯一的方法是在项目中包含一个“ lib”文件夹,并在提交中包含添加的文件。 When you're configuring your project in Netbeans, you can specify which folders to put on the classpath. 在Netbeans中配置项目时,可以指定要放在类路径中的文件夹。 Add your lib folder to the classpath and place your libraries and other dependencies in there. 将您的lib文件夹添加到类路径,然后将您的库和其他依赖项放在其中。 Keep in mind, though, that it's generally not recommended to use git to track binary files. 但是请记住,通常不建议使用git跟踪二进制文件。 Binary files are usually fairly large, especially if you're checking in all the libraries and resources needed to build your application, and it will make cloning your repository painfully slow. 二进制文件通常很大,尤其是如果您要检入构建应用程序所需的所有库和资源时,二进制文件的克隆将非常缓慢。

I would, however, strongly recommend that you consider using a proper build tool like Gradle or Maven. 但是,我强烈建议您考虑使用适当的构建工具,例如Gradle或Maven。 I know you said you don't want to, but unless there is a particularly compelling reason not to, you're only making things significantly harder for yourself. 我知道您说过您不想这么做,但是除非有特别令人信服的理由不这样做,否则您只会使自己的工作变得更加困难。 Maven will handle your dependencies, as well as running your unit tests and packaging your code for you. Maven将处理您的依赖关系,以及运行单元测试和为您打包代码。 It will save you a lot of time and effort. 这样可以节省大量时间和精力。

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

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