Maven: How to include jars, which are not available in reps into a J2EE project?

后端 未结 10 1063
失恋的感觉
失恋的感觉 2020-11-28 18:17

in my J2EE project I\'ve a couple of dependencies, which are not available in any Maven repository, because they\'re proprietary libraries. These libraries need to be availa

10条回答
  •  [愿得一人]
    2020-11-28 18:49

    As you've said you don't want to set up your own repository, perhaps this will help.

    You can use the install-file goal of the maven-install-plugin to install a file to the local repository. If you create a script with a Maven invocation for each file and keep it alongside the jars, you (and anyone else with access) can easily install the jars (and associated pom files) to their local repository.

    For example:

    mvn install:install-file -Dfile=/usr/jars/foo.jar -DpomFile=/usr/jars/foo.pom
    mvn install:install-file -Dfile=/usr/jars/bar.jar -DpomFile=/usr/jars/bar.pom
    

    or just

    mvn install:install-file -Dfile=ojdbc14.jar -DgroupId=com.oracle -DartifactId=ojdbc14 -Dversion=10.2.0 -Dpackaging=jar
    

    You can then reference the dependencies as normal in your project.

    However your best bet is still to set up an internal remote repository and I'd recommend using Nexus myself. It can run on your development box if needed, and the overhead is minimal.

提交回复
热议问题