在Bitbucket上发布一个android库作为maven工件问题

问题描述 投票:2回答:3

我正在尝试使用this article在Bitbucket存储库上发布一个Android库作为Maven工件

这是我的第一部作品,请解释简单明了什么是POMwagon-gitdeployerJar以及最终如何修复此错误:

我得到这个错误:

错误:无法在类型为org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象上找到参数[ar.com.synergian:wagon-git:0.2.3]的方法deployerJar()。

我的项目级别build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://raw.github.com/synergian/wagon-git/releases"}
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我的应用程序级别(库)build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.1"
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 2
        versionName "1.1"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.google.firebase:firebase-messaging:9.2.1'
    compile 'com.google.firebase:firebase-crash:9.2.1'
    compile 'com.google.android.gms:play-services:9.2.1'
}

apply from: 'uploadArchives.gradle'

和库模块中创建的qazxsw poi文件:

uploadArchives.gradle

谢谢

android maven gradle bitbucket pom.xml
3个回答
1
投票

最后我找到了解决方案

我删除除apply plugin: 'maven' configurations { deployerJar } dependencies { deployerJar "ar.com.synergian:wagon-git:0.2.3" } uploadArchives { configuration = configurations.archives repositories.mavenDeployer { pom.groupId = "com.example" pom.artifactId = "myLibraryName" pom.version = "1.0" configuration = configurations.deployerJar repository(url: "git:master://[email protected]:myTeam/myLibraryName.git"){ authentication(userName: "my_bitbucket_username", password: "my_bitbucket_password") } pom.project { name "myLibraryName" packaging "aar" //POM_PACKAGING description "Some Description" url "https://bitbucket.org/myTeam/myLibraryName" scm { url "https://bitbucket.org/myTeam/myLibraryName" connection "https://[email protected]/myTeam/myLibraryName.git" developerConnection "https://[email protected]/myTeam/myLibraryName.git" } licenses { license { name "The Apache Software License, Version 2.0" url "http://www.apache.org/licenses/LICENSE-2.0.txt" distribution "myLibraryName" } } developers { developer { id "my_bitbucket_username" name "my_bitbucket_name" email "my_email" } } } } } 之外的所有build.gradles杂质

并将apply from: 'uploadArchives.gradle' {object}的值移动到uploadArchives中,如下所示:

gradle.properties

并使用这样的:

GROUP=com.example

并在uploadArchives { configuration = configurations.archives repositories.mavenDeployer { pom.groupId = GROUP ... } } 的末尾添加这个

uploadArchies.gradle

0
投票

POM缺少项目对象模型,是Maven的基本工作单元。

allprojects { repositories { mavenCentral() maven { url "https://raw.github.com/synergian/wagon-git/releases"} } }

https://maven.apache.org/guides/introduction/introduction-to-the-pom.html是具有组ID wagon-git的工件的名称

据我所知,没有ar.com.synergian这个名字的范围


0
投票

我在同一个问题上运行了文章的逐步指导,那就是指导车库链接。为了使工作正常,你需要在原始文件中做的只是替换deployerJarconfigurations部分的排序。 dependencies应该先行。在您的示例中,这也会导致类似于在声明之前声明使用此配置的流程。

© www.soinside.com 2019 - 2024. All rights reserved.