How to include jar in Maven Netbeans proj that doesnt exist in maven repo

别等时光非礼了梦想. 提交于 2019-12-12 13:00:45

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/9473537/how-to-include-jar-in-maven-netbeans-proj-that-doesnt-exist-in-maven-repo

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