简体   繁体   English

如何使用Eclipse作为编辑器在Maven项目中查找和丢失工件?

[英]How to find and missing artifacts in a maven project using eclipse as editor?

I am working on a Maven project and I am using eclipse as an editor. 我正在从事Maven项目,并且正在使用eclipse作为编辑器。 I clone a project from GIT and then create a git repository in eclipse , import it and then create a maven project. 我从GIT克隆一个项目,然后在eclipse中创建一个git存储库,将其导入,然后创建一个maven项目。 After i finished the project of setup i got a lot of errors and this is due to pom.xml file and I am missing about 300 artifacts.I know want to know how can i find and add those artifacts in my project. 完成安装项目后,我遇到了很多错误,这是由于pom.xml文件造成的,我缺少了约300个工件。我知道想知道如何在我的项目中查找和添加这些工件。 I have seen different answers for that and one of the answers is to upload maven project. 我看到了不同的答案,答案之一就是上传maven项目。 I did it but still not working , I am still missing the artifacts. 我做到了,但仍然无法正常工作,我仍然缺少这些工件。

I really need some help here since i want to start working on this project as soon as possible. 我真的需要这里的帮助,因为我想尽快开始从事这个项目。

Maven pulls all the dependencies either from maven repository or from local repository automatically (typically C:/Users/user1/.m2 on windows). Maven自动从maven存储库或本地存储库中提取所有依赖项(在Windows上通常为C:/Users/user1/.m2)。 if there are lot of dependencies, eclipse takes a while to download them all. 如果有很多依赖项,eclipse会花一些时间下载所有依赖项。

check if you see building workspace at the right bottom corner of eclipse. 检查是否在Eclipse的右下角看到建筑物工作区。 you can press Alt+F5 to refresh the project and then try command mvn clean install from your root folder (where your pom.xml is placed) 您可以按Alt + F5刷新项目,然后从根文件夹(放置pom.xml的位置)尝试命令mvn clean install

Sometimes, jars are not available on maven repository such as sqljdbc. 有时,jar在Maven存储库(例如sqljdbc)上不可用。 in that case you will have to manually install them to your local repo using below command if you have the .jar file 在这种情况下,如果您具有.jar文件,则必须使用以下命令将它们手动安装到本地存储库中

mvn install:install-file -Dfile=<path-to-file>/stax-1.0.jar         
-DgroupId=stax -DartifactId=stax -Dversion=1.0 -Dpackaging=jar

or a quick and dirty approach would be copy the .m2/repository folder from previous machine if project was working good on that machine. 如果项目在该计算机上运行良好,则可以使用快速而肮脏的方法从以前的计算机复制.m2 / repository文件夹。

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

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