How do you copy Maven dependencies (jar files) from one Java project to another Dynamic web project's WEB-INF/lib folder?

折月煮酒 提交于 2019-12-11 04:16:03

问题


I am trying to use a Java project called "Search" in my another Web project. I exported the Search project as a jar and added to my Web project's WEB-INF/lib folder. The problem is that the Search projects has many dependencies for Accumulo, Hadoop, Zookeeper etc. So how can I copy these maven dependencies/jar files from the Search project to my Web apps' WEB-INF/lib folder so I can get everything working?


回答1:


Since you are using Maven, all you need to do is to add the "Search" project as a dependency to your Web project. Maven will resolve any transitive dependencies like Accumolo, Hadoop, Zookeper, etc, automatically for you.




回答2:


I would simply add the uses things like Accumulo, Hadoop etc. as usual dependencies in your project. So they will be packaged in your war project automatically.




回答3:


There may be other way, but my approach is.

  1. In your project click maven dependencies to expand.
  2. Select Jar Files you require and Copy(Cntrl+C)
  3. Paste it in Notepad++ or in your Eclipse(Any type file)

Now you will get something like this

  1. Clear Download folder in your file system. Because you are downloading all jar files from Browser instead of Navigating to each folder in file system.

  2. Just copy line by line in to your browser URL tab. It will be downloaded to the Downloads from where you can copy easily to the WEB-INF/lib folder.

Note: You can automate this process by

  • Writing a Java code(java.io)
  • Creating array of string or reading from a text file line by line
  • creating array of file copying to a folder by iteration.

Hope it will helps.

Downloaded by manual process



来源:https://stackoverflow.com/questions/11250183/how-do-you-copy-maven-dependencies-jar-files-from-one-java-project-to-another

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!