Hi,
i’m with some trouble running my scripts in the new Android Studio with gradle 3.0.
The problem seems with getting the configuration by name or by position.
Error;
* What went wrong:
Execution failed for task ‘:lib.appbase:generatePomFileForAarPublication’.
> Could not apply withXml() to generated POM
> Configuration with name ‘_releaseImplementation’ not found.
My script:
apply plugin: 'com.android.library’
apply plugin: 'com.jfrog.artifactory’
apply plugin: ‘maven-publish’
android {
compileSdkVersion COMPILE_SDK as int
buildToolsVersion BUILD_TOOLS
defaultConfig {
minSdkVersion MIN_SDK as int
targetSdkVersion TARGET_SDK as int
versionCode BASE_VERSION_CODE as int
versionName '4.0.33'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
disable 'MissingTranslation'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
implementation fileTree(dir: ‘libs’, include: [’*.jar’])
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.2.28'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
implementation 'com.android.support:appcompat-v7:' + SUPPORT_LIBS
implementation 'com.android.support:recyclerview-v7:' + SUPPORT_LIBS
implementation 'com.fasterxml.jackson.core:jackson-core:' + JACKSON_LIB
implementation 'com.fasterxml.jackson.core:jackson-databind:' + JACKSON_LIB
implementation 'com.fasterxml.jackson.core:jackson-annotations:' + JACKSON_LIB
implementation 'com.google.android.gms:play-services-analytics:' + PLAY_SERVICES_LIBS
implementation 'com.google.android.gms:play-services-gcm:' + PLAY_SERVICES_LIBS
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.squareup.okio:okio:1.13.0'
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
}
publishing {
publications {
aar(MavenPublication) {
groupId "my_group"
version = "${android.defaultConfig.versionName}"
artifactId “com.tandeminnovation.appbase”
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("_releaseImplementation").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}
artifactory {
contextUrl = 'repo_url’
publish {
repository {
// The Artifactory repository key to publish to
repoKey = ‘libs-release-local’
username = artifactory_username
password = artifactory_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
}
}
}
PS: I’ve also tried getting config by position (55) but gave illegal access.
Waiting for an advise.