question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set GROUP and VERSION using the base plugin

See original GitHub issue

Hello,

I’m trying to use the base plugin, because I want to publish and Android library to MavenCentral without source code and without Javadoc.

Version is com.vanniktech:gradle-maven-publish-plugin:0.18.0

Here is my configuration:

Main build.gradle file

allprojects {
    plugins.withId("com.vanniktech.maven.publish.base") {
        GROUP = "my.group"
        VERSION = "1.0.0"

        mavenPublishing {
            publishToMavenCentral("S01")
            pomFromGradleProperties()
            signAllPublications()
        }
    }
}

Project build.gradle file

import com.vanniktech.maven.publish.AndroidLibrary
import com.vanniktech.maven.publish.JavadocJar

apply plugin: "com.vanniktech.maven.publish.base"

mavenPublishing {
    configure(new AndroidLibrary(new JavadocJar.Empty(), false))
}

Result

I get this error:

groovy.lang.MissingPropertyException: Could not set unknown property ‘VERSION’

If GROUP and VERSION are not set (if I comment out the 2 lines), when publishing using this command:

./gradlew publish --no-daemon --no-parallel

I get this error:

Could not PUT 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/android/project/unspecified/project-unspecified.aar'. Received status code 400 from server: Bad Request

it seems that group and version (= “unspecified”) are not correct in this path.

Using the main plugin, it works fine, but Javadoc and source code are also published, and I cannot find a way to disable this using the main plugin.

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bmartycommented, Sep 24, 2021

Thanks, sorry, I was not able to test this earlier, but it’s working great! Thanks @Ahmad-Hamwi for the PR 😃

1reaction
vanniktechcommented, Sep 24, 2021

@Ahmad-Hamwi mind creating a PR to fix the documentation?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Base Plugin
The Base Plugin adds the base extension to the project. This allows to configure the following properties inside a dedicated DSL block. Example...
Read more >
How to set the project name/group/version, plus {source ...
settings.gradle: rootProject.name = theName. build.gradle: apply plugin: "java" group = theGroup version = theVersion sourceCompatibility = ...
Read more >
Gradle - Plugins
The plugins can do the things such as −. Extend the basic Gradle model (e.g. add new DSL elements that can be configured)....
Read more >
Gradle tips and recipes
Gradle and the Android plugin allow you to create different versions of your app from a single module by configuring build variants. Configure...
Read more >
Introduction to writing Gradle plugins
id 'org.springframework.boot' version '2.5.4' ... For example, with the Java plugin you can configure tests to be included or excluded by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found