Gradle: Make a 3rd party jar available to local gradle repository

前端 未结 6 1675
我在风中等你
我在风中等你 2020-12-04 17:44

currently, I\'m testing Gradle as an alternative to Maven. In my projects, there are some 3rd party jars, which aren\'t available in any (Maven) repositories. My problem is

6条回答
  •  长情又很酷
    2020-12-04 18:22

    In short: deploy to repository manager. It can local, on company LAN.

    An altogether different way of thinking about this type of problem, specially if it happens often, is to use a repository manager. There are some great open source options out there such as Artifactory, Nexus or Archiva.

    Lets assume you have a jar file from some dubious origin that needs to be included in your build until you have the opportunity of refactoring it out. A repository manager would allow you to upload the file to your own repository as, for the sake of this example, dubious-origin-UNKNOWN.jar

    Then your build.gradle would look something like this:

    repositories {
        mavenRepo urls: "http://your.own.repository/url";
    }
    
    dependencies {
        compile "dubious:origin:UNKNOWN";
    }
    

    There are a lot of other advantages to using a repository manager such as caching of remote artifacts, remove artifacts from scm, staging releases, more granular user permissions, and so forth.

    On the down side, you would be adding a server which carries some maintenance overhead to keep your builds running.

    Depends on the size if your project, I suppose.

提交回复
热议问题