简体   繁体   English

我应该将jar文件保存在哪里,以便所有项目都可以使用它们?

[英]Where Should i keep my jar files so that All projects commonly used them?

I Have to deploy 40 to 50 Spring Mvc project on Linux server So every project must contains Spring jar file in its lib folder 我必须在Linux服务器上部署40到50个Spring Mvc项目,因此每个项目都必须在其lib文件夹中包含Spring jar文件

Is there any way to keep all jar file at one one place so that all the projects could use 有什么办法可以将所有jar文件保存在一个地方,以便所有项目都可以使用

I have tried to placed all file in Apache-tomcat's lib folder and remove Spring's jar file from the Spring MVC's project lib folder 我试图将所有文件放在Apache-tomcat的lib文件夹中,并从Spring MVC的项目lib文件夹中删除Spring的jar文件。

But after that all the url stop working and i didn't get any exception and i also compile all java files by using the 但是在那之后所有的url都停止工作了,我也没有得到任何异常,而且我还通过使用编译了所有的java文件。

javac -cp :/path of Apache-tomcat's lib/*.jar: className.java

I didnt get any exception all filed compiled successfully 我没有得到任何例外,所有文件都已成功编译

If anyone knows how can i managed these jar files then please let me know 如果有人知道如何管理这些jar文件,请告诉我

Should i need to define the path in projects files like web.xml or meta-inf So that When the projects run it automatically find the jar at some specific place... 我是否需要在像web.xml或meta-inf这样的项目文件中定义路径,以便在项目运行时自动在某个特定位置找到jar。

  • When you deploy web application to production server (Apache Tomcat in this case), you don't copy any JAR file for application working, because application packaged in WAR file format. 将Web应用程序部署到生产服务器(在本例中为Apache Tomcat)时,您不会复制任何JAR文件来使应用程序正常工作,因为应用程序以WAR文件格式打包。
  • If you want using many Spring-based web applications for development, testing purpose, you also don't need copy JAR files many times. 如果您想使用许多基于Spring的Web应用程序进行开发和测试,则也不需要多次复制JAR文件。 Use Gradle or Maven dependencies management tool. 使用Gradle或Maven依赖项管理工具。 (You maybe need covert legacy project to new project structure when use new generation build tools like Gralde, Maven). (当使用诸如Gralde,Maven之类的新一代构建工具时,您可能需要将隐蔽的旧项目转换为新的项目结构)。

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

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