Maven: How to include jars in Eclipse, which are not available in repository?

前端 未结 5 1477
自闭症患者
自闭症患者 2020-12-16 16:40

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

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-16 17:03

    I believe the system dependency approach shouldn't be used unless you don't have any other choice, and that's because you're loosing the whole 'build portability thing' here. Of course you can store your jars in your source control system together with your project's source files, but I don't think its a good approach neither...

    Using only install:install-file is not good enough - this would indeed deploy the jars in the proper format into your local repository, but what happens when you'll move to another computer and start to build your project there? You will need to make this once more.

    So, If you don't want to install nexus/artifactory (which is the best solution, I believe), you probably should create an another repository (just in a file system on some of your servers), and deploy the jars there (you can use mvn install:install-file as was suggested here, and then just copy the whole tree). Now you can configure apache web server and access the directory with all your jars via http. I don't believe its better then nexus/artifactory approach, but it can be a little be easier to do if you're familiar with apache web server. In order to get your maven aware about this new repository you'll need to edit the %MAVEN_HOME%\conf\settings.xml file

提交回复
热议问题