简体   繁体   English

我如何使用Maven将lib文件夹中的罐子添加为单独的依赖项

[英]How can i add the jars in my lib folder as individual dependencies using maven

I have a legacy Java Webapp (Struts2), where all my dependencies are present in WebContent/WEB-INF/lib folder. 我有一个遗留的Java Webapp(Struts2),我的所有依赖项都位于WebContent / WEB-INF / lib文件夹中。 I have tried to convert the entire project to Maven using Eclipse>Configure>Convert-to-Maven-Projet and new pom file was generated successfully. 我尝试使用Eclipse> Configure> Convert-to-Maven-Projet将整个项目转换为Maven,并成功生成了新的pom文件。

How can i add the jars in my lib folder as individual dependencies in my pom.xml and manage them using pom.xml . 如何在我的lib文件夹中将jars添加为pom.xml各个依赖项,并使用pom.xml对其进行管理。 I don't want to point to the lib folder during maven package and include the jars in my final war file, instead i would like to get rid of the all the jars in lib folder and manage them using pom.xml , just like any other Maven Project. 我不想在maven打包期间指向lib文件夹并将jar保存在我的最终war文件中,而是想摆脱lib文件夹中的所有jar并使用pom.xml对其进行管理,就像任何其他方式一样其他Maven项目。

What is the best way to achieve this ? 实现此目标的最佳方法是什么? Is there any automated process or do i need to manually add dependencies in pom.xml ? 是否有任何自动化过程,或者我需要在pom.xml手动添加依赖项? (FYI - all my jars are standard Java dependencies like Struts,Log4j,Apache Commons etc., so i can get them from Maven central repo). (仅供参考-我所有的jar都是标准Java依赖项,例如Struts,Log4j,Apache Commons等,因此我可以从Maven中央存储库中获取它们)。

There isn't an automatted process to do that task for you, because jars can be included in different dependencies. 没有自动执行的过程可以为您完成此任务,因为jar可以包含在不同的依赖项中。 You have to add them manually to your pom file. 您必须将它们手动添加到pom文件中。

暂无
暂无

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

相关问题 无法看到如何告诉Maven在lib文件夹上安装jar - Can't see how to tell Maven to install jars on lib folder Maven:不需要的jar污染了我的lib文件夹 - Maven: Unrequested jars polluting my lib folder 我需要将哪些Apache Commons IO jar添加到我的Android lib文件夹中? - Which Apache Commons IO jars do I need to add to my Android lib Folder? Maven:如何将模块依赖项包含到常规的depends-jars文件夹中 - Maven: how to include module dependencies into general dependency-jars folder 如何使用 Maven 构建将常规文件夹添加到我的存储库? - How can I add regular folder to my repository using a Maven build? 如何使用Maven在jar的子文件夹中创建具有依赖项的可执行jar? - How can I create an executable jar with dependencies in sub folder in jar using Maven? 如何在Maven中为某些依赖项定义不同的目标文件夹 - How can I define a different target folder for some dependencies in Maven 有没有办法我可以使用maven基于我的构建路径中存在的jar文件自动添加依赖项? - Is there a way by which i can automatically add dependencies based on the jar files present in my build path using maven? 如何让Eclipse自动将我放在WEB-INF / lib文件夹中的jar包含到我的项目中? - How do I make Eclipse automatically include jars I place in my WEB-INF/lib folder into my project? Maven 包从依赖项添加 jars 到 jar - Maven package add jars from dependencies to jar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM