Maven: Including jar not found in public repository

前端 未结 6 1350
暖寄归人
暖寄归人 2020-12-02 07:23

If I was to use a 3rd party library that was not in the maven public repository, what is the best way to include it as dependency for my project so that when someone else ch

6条回答
  •  情深已故
    2020-12-02 08:10

    Using system scope may work but it is not recommended even in the Maven specification. it is not portable.

    from Maven book:

    system- The system scope is similar to provided except that you have to provide an explicit path to the JAR on the local file system. This is intended to allow compilation against native objects that may be part of the system libraries. The artifact is assumed to always be available and is not looked up in a repository. If you declare the scope to be system, you must also provide the systemPath element. Note that this scope is not recommended (you should always try to reference dependencies in a public or custom Maven repository).

    The best approach is to install to your local repository or to your enterprise repository to be accessible to all your peers.

    this is very easy if you are using a repository manager such as Nexus.

提交回复
热议问题