Java 如何在Eclipse IDE项目文件夹中为spring添加jar文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20225845/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 00:25:37  来源:igfitidea点击:

How to add jar files for spring in Eclipse IDE project folder

javaeclipsespring

提问by user3014290

I am going to start MVC with Spring framework, but I am unable to get jar file of spring framework .I have tried in help menu>install new software>addnew in Eclipse IDE but I failed. Can anyone please guide me ?

我打算用 Spring 框架启动 MVC,但我无法获得 spring 框架的 jar 文件。我尝试过menu>install new software>add在 Eclipse IDE中的帮助新,但我失败了。任何人都可以指导我吗?

回答by Dan

There are several options.

有几种选择。

One you could download Spring Tool Suitewhich is an Eclipse-based development environment that is customized for developing Spring applications. This might be your best bet because this will contain everything you need in one neat package.

您可以下载Spring Tool Suite,它是一种基于 Eclipse 的开发环境,专为开发 Spring 应用程序而定制。这可能是您最好的选择,因为它将在一个整洁的包装中包含您需要的一切。

Second, you can create a Mavenproject which will allow you to add the Spring dependencies in a pom.xml file. This might not be ideal because then you would have to learn Maven but once you get past the learning curve it is amazingly simple to add jars to your web project.

其次,您可以创建一个Maven项目,该项目将允许您在 pom.xml 文件中添加 Spring 依赖项。这可能并不理想,因为那时您将不得不学习 Maven,但是一旦您通过了学习曲线,将 jar 添加到您的 Web 项目中是非常简单的。

Lastly, you can download each Spring jar individually (probably the least effective method) and then add the library to your Eclipse environment. To do this save the jar to a location on your hard drive, open eclipse, right click on your project, select properties, click on Java Build Path, click the Libraries tab and then Add External JARS...

最后,您可以单独下载每个 Spring jar(可能是效率最低的方法),然后将该库添加到您的 Eclipse 环境中。为此,将 jar 保存到硬盘驱动器上的某个位置,打开 eclipse,右键单击您的项目,选择属性,单击 Java 构建路径,单击库选项卡,然后添加外部 JARS...

I hope this helps!

我希望这有帮助!

回答by Marcelo Tataje

You can try download STS (Spring Source Tool Suite) from this link:

您可以尝试从此链接下载 STS(Spring Source Tool Suite):

http://spring.io/tools

http://spring.io/tools

Of course, you should try Maven which is easy to use and adds value to the libraries and additional components you handle in your project.

当然,您应该尝试使用 Maven,它易于使用,可为您在项目中处理的库和其他组件增加价值。

If you want to add the libraries manually and work without any library handler like maven, then you can do the following:

如果您想手动添加库并且在没有任何库处理程序(如 maven)的情况下工作,那么您可以执行以下操作:

  1. Create a new Java Project
  2. Over your project, right click and then create a new folder, call it "libs"
  3. Download the latest libraries of Spring 3 MVC: http://projects.spring.io/spring-framework/
  4. Once you've downloaded the libraries, extract the content of the zip and copy the required "jar" files inside the folder "libs" you've just created.
  5. Once you copied the files to the folder, select all the files, right-click, look at "Build Path" and click on "Add to Build Path"
  6. then in the project explorer, you will be able to see that in "Referenced Libraries" you have the Spring libraries.
  7. Just have fun.
  1. 创建一个新的 Java 项目
  2. 在您的项目上,右键单击然后创建一个新文件夹,将其命名为“libs”
  3. 下载 Spring 3 MVC 的最新库:http: //projects.spring.io/spring-framework/
  4. 下载库后,解压缩 zip 的内容并将所需的“jar”文件复制到您刚刚创建的文件夹“libs”中。
  5. 将文件复制到文件夹后,选择所有文件,右键单击,查看“构建路径”,然后单击“添加到构建路径”
  6. 然后在项目资源管理器中,您将能够看到在“参考库”中您拥有 Spring 库。
  7. 只是玩得开心。

But as recommended and suggested, try downloading maven, there is an integration also if you go and install from the Eclipse Market: m2eclipse.

但是按照推荐和建议,尝试下载 maven,如果您从 Eclipse Market 安装,也有一个集成:m2eclipse。

Then, another option is like many people answered you: use STS, which comes with maven and will make your work easier and faster.

然后,另一个选择就像很多人回答你一样:使用STS,它是maven自带的,会让你的工作更轻松、更快捷。

Now seems like Spring just wants to work with dependency managers, so you can go to the central repository and download the parts you need, here you have the link:

现在似乎 Spring 只想与依赖项管理器一起工作,因此您可以转到中央存储库并下载您需要的部分,这里有链接:

http://mvnrepository.com/artifact/org.springframework/

Regards.

问候。