是否可以在不安装jar的情况下将jar添加到maven 2 build classpath?

我与影子孤独终老i 提交于 2020-05-02 17:41:28

问题:

Maven2 is driving me crazy during the experimentation / quick and dirty mock-up phase of development. 在试验/快速而肮脏的开发阶段,Maven2让我发疯。

I have a pom.xml file that defines the dependencies for the web-app framework I want to use, and I can quickly generate starter projects from that file. 我有一个pom.xml文件,该文件定义了要使用的Web应用程序框架的依赖项,并且可以从该文件快速生成启动程序项目。 However, sometimes I want to link to a 3rd party library that doesn't already have a pom.xml file defined, so rather than create the pom.xml file for the 3rd party lib by hand and install it, and add the dependency to my pom.xml , I would just like to tell Maven: "In addition to my defined dependencies, include any jars that are in /lib too." 但是,有时我想链接到尚未定义pom.xml文件的第三方库,因此,不是手动为第三方库创建pom.xml文件并安装它,然后将依赖项添加到我的pom.xml ,我想告诉Maven:“除了定义的依赖项之外,还包括/lib所有jar。”

It seems like this ought to be simple, but if it is, I am missing something. 看起来这应该很简单,但是如果是这样,我就缺少了一些东西。

Any pointers on how to do this are greatly appreciated. 任何有关如何执行此操作的指针将不胜感激。 Short of that, if there is a simple way to point maven to a /lib directory and easily create a pom.xml with all the enclosed jars mapped to a single dependency which I could then name / install and link to in one fell swoop would also suffice. 简而言之,如果有一种简单的方法将maven指向/lib目录并轻松创建pom.xml并将所有封闭的jar映射到单个依赖项,然后我可以命名/安装并链接到一个依赖项中,也足够。


解决方案:

参考一: https://stackoom.com/question/1Wio/是否可以在不安装jar的情况下将jar添加到maven-build-classpath
参考二: https://oldbug.net/q/1Wio/Can-I-add-jars-to-maven-2-build-classpath-without-installing-them
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!