如何在Maven Netbeans proj中包含不存在于maven repo中的jar [英] How to include jar in Maven Netbeans proj that doesnt exist in maven repo

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

问题描述

我正在使用Netbeans构建一个Maven项目,并将JTidy的java库作为依赖。事实证明,JTidy不存在于任何maven回收站,所以我不能仅仅添加一个正常依赖条目。



在repos上不可用的Maven项目中,处理依赖关系的最佳方式是什么?



I目前,我试图将它添加到我的maven pom中(将jar复制到我的项目/ libs文件夹中)

 依赖性> 
< groupId> org.w3c< / groupId>
< artifactId> org.w3c.tidy< / artifactId>
< version> 9.3.8< / version>
< scope> system< / scope>
< systemPath> $ {basedir} /libs/jtidy-r938.jar</systemPath>
< / dependency>

然而,它抱怨说依赖项目将无法解决。

解决方案

首先,这是另一个groupId,这就是为什么没有找到它。

 <依赖关系> 
< groupId> net.sf.jtidy< / groupId>
< artifactId> jtidy< / artifactId>
< version> r938< / version>
< / dependency>

Jtidy



但是为了回答你的问题,一种方法是手动安装此处所述的本地回购。



IMHO将其添加到代理中的最佳方式,如 Nexus 。这样,其他人可以从那里访问它,而无需在本地安装。但是,这意味着您必须设置一个存储库管理器,如果您是项目中唯一的开发人员,那么这并不重要。


I am using Netbeans to build a Maven project, and have the JTidy java library as a dependency. It turns out JTidy doesnt exist in any maven repos, so I can't just add a "normal" depedency entry for it.

What is the best way of handling dependencies to libraries in Maven projects that arent available on repos?

I've currently tried adding it to my maven pom as such (after copying the jar to my projects /libs folder)

    <dependency>
        <groupId>org.w3c</groupId>
        <artifactId>org.w3c.tidy</artifactId>
        <version>9.3.8</version>
        <scope>system</scope>
        <systemPath>${basedir}/libs/jtidy-r938.jar</systemPath>
    </dependency> 

However it complains that it will be unresolvable by dependent projects.

解决方案

First of all, it's under another groupId, that's why you didn't find it.

  <dependency>
        <groupId>net.sf.jtidy</groupId>
        <artifactId>jtidy</artifactId>
        <version>r938</version>
    </dependency>

Jtidy

But to answer your question, one way of doing this is to manually install it in your local repo as described here.

The best way IMHO is to add it to a proxy like Nexus. That way other people can access it from there without having to install it locally. However, this means you have to set up a repository manager, which doesn't make much sense if you are the only developer on the project.

这篇关于如何在Maven Netbeans proj中包含不存在于maven repo中的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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