如何将库Jar文件添加到模块中?

huangapple go评论86阅读模式
英文:

How Can i add Library Jar files into the modules

问题

I am trying to use loaded jar files of my class path into my module. I know requires will accept only modules names. my jar files are present inside the Spring Jar Files folder. I tried to use @Configuration annotation inside my appConfig.java file and IDE could not recognize it. Your help is much appreciated as I am new to the programming world.

英文:

> I am trying to use loaded jar files of my class path into my module. I
> know requires will accept only modules names.
> my jar files are present inside the Spring Jar Files folder.
> I tried to use @Configuration annotation inside my appConfig.java file and IDE could not recognize it.

Your help is much appreciated as I am new to the programming world.

如何将库Jar文件添加到模块中?

答案1

得分: 2

Normally, I use Maven or Gradle to handle all the jars.

It seems you have just started with Spring.
I suggest you try Spring Boot with Maven or Gradle to manage the library and the code lifecycle (compile, build, test).
This is one tutorial for example: https://spring.io/guides/gs/spring-boot/

英文:

Normally, I use Maven or Gradle to handle all the jars.

It seems you have just started with Spring.
I suggest you try Spring Boot with Maven or Gradle to manage the library and the code lifecycle (compile, build, test).
This is one tutorial for example: https://spring.io/guides/gs/spring-boot/

答案2

得分: 0

你可以通过在Eclipse上右键单击项目→构建路径→配置构建路径来添加一个jar文件。在“库”选项卡下,点击“添加Jars”或“添加外部JARs”,然后提供JAR文件。
示例链接

上述解决方案显然是一个“快速”解决方案。然而,如果你正在开发一个需要将文件提交到源代码控制存储库的项目中,我建议将Jar文件添加到源代码控制存储库内的专用库文件夹,并如上所述引用其中的一些或全部文件。

如果你计划将其作为一个正式项目构建并将其放入源代码控制存储库中,我建议选择第二种方法。

英文:

You can add a jar in Eclipse by right-clicking on the Project → Build Path → Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar.
Example link

The above solution is obviously a "Quick" one. However, if you are working on a project where you need to commit files to the source control repository, I would recommend adding Jar files to a dedicated library folder within your source control repository and referencing few or all of them as mentioned above.

I'd suggest go for the second one if you are planning to build this as a proper project and put it in a source control repo.

huangapple
  • 本文由 发表于 2020年8月2日 11:37:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/63212144.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定