简体   繁体   English

在私有服务器上设置 Maven Repository 以共享 Android Studio 的 android 库

[英]Setup Maven Repository on private server to share the android library for Android Studio

I have a Gitlab server for Version Control System.我有一个用于版本控制系统的 Gitlab 服务器。 I have developed an android library and want to share the android library in a gradle way ie compile "com.mycompanyname.libraryname:version .我开发了一个 android 库,并希望以 gradle 方式共享 android 库,即compile "com.mycompanyname.libraryname:version

I need a guidance on how to set up the repository on my server and how to share the library for gradle building.我需要有关如何在我的服务器上设置存储库以及如何共享库以构建 gradle 的指导。

I am trying to achieve a gradle mechanism using below given setup:我正在尝试使用以下给定的设置来实现 gradle 机制:

buildscript {
  repositories {
    jcenter()
    maven { url 'https://any_url_/public' }
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:1.0.+'
    classpath 'io.anything:gradle:1.+'
  }
}

apply plugin: 'com.android.application'

repositories {
    jcenter()
    maven { url 'https://any_url/public' }
}

Local artifact repository would be probably JFrog Artifactory, Apache Archiva or Sonatype Nexus.本地工件存储库可能是 JFrog Artifactory、Apache Archiva 或 Sonatype Nexus。 Here's a co-edited comparison matrix .这是一个共同编辑的比较矩阵 All three have OSS versions which should do the job for Gradle builds.这三个版本都有 OSS 版本,可以完成 Gradle 构建的工作。

Both JFrog and Sonatype have free instances of Artifactory and Nexus correspondingly for OSS projects, so you don't even need to maintain your own server if you don't want to. JFrog 和 Sonatype 都有对应 OSS 项目的ArtifactoryNexus 的免费实例,所以如果你不想,你甚至不需要维护自己的服务器。

Regarding publishing to a local Maven repository and releasing to JFrog Bintray (jcenter) and to Maven Central, there are a lot of good guides ( here's one, for example ).关于发布到本地 Maven 存储库以及发布到 JFrog Bintray (jcenter) 和 Maven Central,有很多很好的指南( 例如,这里有一个)。

If you will end up using Artifactory, then you can publish to Bintray JCenter and Maven Central directly from it (that's what Spring Framework, Groovy, Grails and many others are doing), here's the REST API that you'll call (or you can use the UI ).如果您最终会使用 Artifactory,那么您可以直接从它发布到 Bintray JCenter 和 Maven Central(这就是 Spring Framework、Groovy、Grails 和许多其他人正在做的事情),这是您将调用的 REST API (或者您可以使用用户界面)。


I am with JFrog , the company behind Bintray and [artifactory] , see my profile for details and links.我与JFrog 合作,这是Bintray[artifactory]背后的公司,有关详细信息和链接,请参阅我的个人资料。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM