I'm new working with Gradle and Artifactory and I used an example that is not working correctly from this example site I have this error message:
Extension of type 'PublishingExtension' does not exist. Currently registered extension types: [DefaultExtraPropert iesExtension, DefaultArtifactPublicationSet_Decorated, ReportingExtension_Decorated, DefaultProjectComponentContai ner_Decorated, DefaultProjectSourceSet_Decorated, DefaultBinaryContainer_Decorated]
I have an error in this line:
defaults{
publications ('mavenJava')
}
Some one could help me with this I have been stuck in this issue for so long.
After reviewing the links as JBaruch recommended and compare with the code I changed the plugin but still the same problem. Maybe I'm confusing something? (That is why I will post the whole source code)
buildscript {
repositories {
maven {
url 'http://.../artifactory/libs-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
name = "maven-main-cache"
}
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.1"
}
}
apply plugin: 'scala'
apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"
version = '1.0.0-SNAPSHOT'
group = 'com.buransky'
repositories {
add buildscript.repositories.getByName("maven-main-cache")
}
dependencies {
compile 'org.scala-lang:scala-library:2.11.2'
}
tasks.withType(ScalaCompile) {
scalaCompileOptions.useAnt = false
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'libs-snapshot-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults{
publications ('mavenJava')
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
Thank you very much
You didn't apply the maven-publish
plugin that is expected to be present with artifactory
plugin.
Please take a look at the documentation, also this answer might help (note the plugins names change).
I lost a lot of time on this since Artifactory docs use outdated Android Studio & gradle plugins versions, so here is my working conf with AS 1.5.1 and gradle 1.5.0 :
global build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
}
module build.gradle
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
publishing{
publications {
maven(MavenPublication) {
groupId packageName
version = libraryVersion
artifactId project.getName()
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
}
}
}
artifactory {
contextUrl = // yours
publish {
repository {
// The Artifactory repository key to publish to
repoKey = 'libs-release-local'
username = // yours
password = // yours
}
defaults {
publishArtifacts = true
publications ('maven')
// 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
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With