如何告诉M2Eclipse安装jar文件作为一个maven依赖 [英] How to tell M2Eclipse to install jar file as a maven dependency
问题描述
我想添加 jpoller.jar
作为一个maven依赖关系,所以我编辑了我的pom.xml文件来包含它:
I want to add jpoller.jar
as a maven dependency, so I edited my pom.xml file to include it:
<dependency>
<groupId>org.sadun</groupId>
<artifactId>jpoller</artifactId>
<version>1.5.2</version>
</dependency>
现在,正如预期的那样,当我从命令行编译时,我收到一个错误,因为 jpoller
不在我的pom中列出的任何存储库中,也没有找到它。虽然我可以为它创建一个存储库,但我宁愿不在这一点上。因此,我收到以下错误:
Now, as expected, when I compile from the command line I get an error because jpoller
isn't in any of the repositories I have listed in my pom, nor could I find one for it. Although I could create a repository for it, I'd rather not at this point. Thus, I get the following error:
[INFO]无法解析工件。
[INFO] Failed to resolve artifact.
缺少:
---------- 1)org.sadun:jpoller:jar:1.5.2
Missing: ---------- 1) org.sadun:jpoller:jar:1.5.2
尝试下载从项目网站手动文件
。
Try downloading the file manually from the project website.
然后,使用以下命令安装它:
mvn install:install-file -DgroupId = org.sadun -DartifactId = jpoller -Dversion = 1.5.2 -Dpackaging = jar -Dfile = / path / to / file
Then, install it using the command: mvn install:install-file -DgroupId=org.sadun -DartifactId=jpoller -Dversion=1.5.2 -Dpackaging=jar -Dfile=/path/to/file
我该怎么办这是从maven CLI不可用的机器上的M2Eclipse插件?
How can I do this from the M2Eclipse plugin on machines where the maven CLI isn't available?
推荐答案
我从M2Eclipse插件在maven CLI不可用的机器上这样做?
How can I do this from the M2Eclipse plugin on machines where the maven CLI isn't available?
嗯,只需从Eclipse中做。首先,获取该jpoller jar并将其保存在文件系统上的某个位置。然后,在Eclipse中,从运行配置...运行配置... ,然后在 Maven Build 上右键单击,然后配置 > New_configuration 新建:
Well, simply do it from Eclipse. First, get that jpoller jar and save it somewhere on your file system. Then, in Eclipse, from the top bar, Run > Run Configurations... then right-click on Maven Build and configure the New_configuration freshly created:
- 选择任意的基本目录
- 使用
install来安装目标:install-file
- 添加参数,不需要
-D
前缀(例如file
as参数
和
/ path / to / file
作为价值等等groupId
,artifactId
,包装
和版本
)。
- Select an arbitrary Base directory
- Fill the Goals with
install:install-file
- Add parameters for each required parameters, without the
-D
prefix (e.g.file
asParameter name
and/path/to/file
as Value and so on forgroupId
,artifactId
,packaging
andversion
).
并运行此配置。或者只是安装Maven。
And run this configuration. Or... just install Maven.
这篇关于如何告诉M2Eclipse安装jar文件作为一个maven依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!