Maven:如何在Eclipse中包含jar,它们在存储库中不可用? [英] Maven: How to include jars in Eclipse, which are not available in repository?

查看:181
本文介绍了Maven:如何在Eclipse中包含jar,它们在存储库中不可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将JAR复制到 src\main\webapp\WEB-INF \ lib

我使用eclipse。如果我将jar一个一个地添加到Project-> Java Build Path-> Add jars,然后我执行Project-> Maven-> Update Project Configuration,它们将被Maven删除。 Eclipse显示错误,其中包含xxx无法解析。

I have copied the JARs into src\main\webapp\WEB-INF\lib.
I use eclipse. If I add the jars one-by-one to Project-> Java Build Path-> Add jars, then I do Project-> Maven-> Update Project Configuration, they are removed by Maven. And Eclipse shows errors, which contain " xxx cannot be resolved".

Env:
Eclipse Java EE IDE for Web Developers.
Version: Indigo Service Release 1
Build id: 20110916-0149

m2e - Maven Integration for Eclipse 1.0.100.20110804-1717

注意:我不想创建自己的Maven存储库。它只会被使用一次。

我该怎么办?

Note: I don't want to create my own Maven repository. It will be just used once.
How should I proceed ?

推荐答案

并非所有的库都可以找到在公共Maven存储库中,例如您自己的库或专有库。无论如何,首先你可以搜索Maven资源库,也许其中一些存在。

Not all libraries can be found in a public Maven repository, for example your own libraries or proprietary libraries. Anyway first you can search the Maven Repository, maybe some of them are there.

如果它们确实不存在,并且您不想安装 Nexus 或< a href =http://www.jfrog.com/products.php =noreferrer> Artifactory ,您可以选择以下两种方法之一:

In case they are really not there, and you don't want to install Nexus or Artifactory, you can choose one of these two approaches:


  • 将jar安装在本地存储库缓存中,无需创建特殊存储库。请参阅有关mkyong的说明

另一种方法是使用系统依赖,你只需要在文件系统中放置一个到达Jar的路径。这是一种不太推荐的方法,但如果你真的想要它会起作用。这是官方文档

another approach is using system dependencies, you just put a path to reach the Jar in the filesystem. It's a less recommended approach, but if you really want it will work. Here is the official documentation.

这篇关于Maven:如何在Eclipse中包含jar,它们在存储库中不可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆