简体   繁体   English

将具有多个模块的 Android 库发布到 jFrog artifactory 的问题

[英]Issue in publishing Android library with multiple modules to jFrog artifactory

I have 2 library modules in my Android project.我的 Android 项目中有 2 个库模块。

mainlibrary
  -sublibrary

The sublibrary module is being used in mainlibrary.子库模块正在主库中使用。 Inside build.gradle (Module: mainlibrary) , I have imported the entire sublibrary module -build.gradle (Module: mainlibrary) 中,我导入了整个子库模块 -

implementation project(':sublibrary')

This is how I ship mainlibrary as a library using jFrog artifactory, code present in build.gradle (Module: mainlibrary) -这就是我使用 jFrog artifactory 将mainlibrary作为库发布的方式,代码存在于build.gradle(模块:mainlibrary)中-

publishing {
    publications {
        aar(MavenPublication) {
            groupId 'in.mikel.reusablelibs'
            version '1.0.4'
            artifactId project.getName()
            artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
        }
    }
}

artifactory {
    contextUrl = 'https://mikel.jfrog.io/artifactory/'
    publish {
        repository {
            // The Artifactory repository key to publish to
            repoKey = 'mikelcl-gradle-release-local'

            username = "***"
            password = "***"
        }
        defaults {
            // Tell the Artifactory Plugin which artifacts should be published to Artifactory.
            publications('aar')
            publishArtifacts = true

            // Properties to be attached to the published artifacts.
            properties = ['qa.level': 'basic', 'dev.team': 'core']
            // Publish generated POM files to Artifactory (true by default)
            publishPom = true
        }
    }
}

I also want sublibrary to be packaged when publishing to jFrog artifactory.我也想子库发布到jFrog artifactory的时候要打包。

Do I need to write separate information in build.gradle (Module: sublibrary) ?我需要在 build.gradle (Module: sublibrary) 中编写单独的信息吗? How can that be handled ?怎么处理?

You don't have to write a separate build.gradle file.您不必编写单独的 build.gradle 文件。 You can configure sublibrary in the root build.gradle.您可以在根 build.gradle 中配置sublibrary库。 For example:例如:

project('sublibrary') {
    publishing {
        publications {
            aar(MavenPublication) {
                groupId 'in.mikel.reusablelibs'
                version '1.0.4'
                artifactId project.getName()
                // Tell maven to prepare the generated "*.aar" file for publishing
                artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
            }
        }
    }
    artifactoryPublish {
        publications(publishing.publications.aar)
    }
}

Make sure Artifactory and maven-publish plugins are applied in the sublibrary project:确保在子sublibrary项目中应用了 Artifactory 和 maven-publish 插件:

apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'

Read more:阅读更多:

  1. Example 例子
  2. Documentation 文档

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

相关问题 使用 JFrog Artifactory 的 Kotlin 多平台库 - Use Kotlin Multiplatform Library from JFrog Artifactory 如何将Android Apk发布到Jfrog人工制品 - How to publish android Apk to Jfrog artifactory 使用 jFrog artifactory 发布了一个库,使用库时未加载外部依赖项 - Published a library with jFrog artifactory, external dependencies not loading when using library Gradle Artifactory插件-寻找从项目中多个模块发布工件的示例吗? - Gradle Artifactory Plugin - looking for example of publishing artifacts from multiple modules in a project? 如何在 android 项目的 gradle 文件中使用 Jfrog Artifactory 包 - How to use Jfrog Artifactory packages in an gradle file in an android project 如何将android库发布到Jfrog bintray? - How to publish android library to Jfrog bintray? 使用多个库模块聚合Javadoc for Android项目 - Aggregate Javadoc for Android project with multiple library modules Artifactory发布带有资源的Android库 - Artifactory Publish Android Library with Resources 使用jfrog.bintray HTTP / 1.1 404发布库未找到[message:Repo''未找到] - Publishing a library using jfrog.bintray HTTP/1.1 404 Not Found [message:Repo '' was not found] 发布需要依赖的 Android 库 - Publishing Android library that needs dependencies
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM