New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deprecate old mavenPublish extension #340
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,9 @@ uses Gradle properties. It's generally recommended to set them in your `gradle.p | |
file. | ||
|
||
```properties | ||
SONATYPE_HOST=DEFAULT | ||
RELEASE_SIGNING_ENABLED=true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here as above |
||
|
||
GROUP=com.test.mylibrary | ||
POM_ARTIFACT_ID=mylibrary-runtime | ||
VERSION_NAME=3.0.5 | ||
|
@@ -67,22 +70,19 @@ Without any further configuration the plugin has two tasks. `publish` which will | |
to Maven Central (through Sonatype OSSRH) by default. To publish to the local maven repository on your | ||
machine (`~/.m2/repository`) there is `publishToMavenLocal`. | ||
|
||
In case you are using `s01.oss.sonatype.org` you need to configure that like this: | ||
```groovy | ||
allprojects { | ||
plugins.withId("com.vanniktech.maven.publish") { | ||
mavenPublish { | ||
sonatypeHost = "S01" | ||
} | ||
} | ||
} | ||
In case you are using `s01.oss.sonatype.org` you need to change the `SONATYPE_HOST` property like this: | ||
```properties | ||
SONATYPE_HOST=S01 | ||
``` | ||
|
||
The username and password for Sonatype OSS can be provided as Gradle properties called `mavenCentralUsername` | ||
and `mavenCentralPassword` to avoid having to commit them. You can also supply them as environment variables | ||
called `ORG_GRADLE_PROJECT_mavenCentralUsername` and `ORG_GRADLE_PROJECT_mavenCentralPassword`. | ||
|
||
To remove the default repository set `sonatypeHost` to `null`. | ||
To remove the default repository set `SONATYPE_HOST` to an empty string. | ||
```properties | ||
SONATYPE_HOST= | ||
``` | ||
|
||
You can add additional repositories to publish to using the standard Gradle APIs: | ||
|
||
|
@@ -128,16 +128,7 @@ signingInMemoryKeyPassword=secret | |
|
||
These properties can also be provided as environment variables by prefixing them with `ORG_GRADLE_PROJECT_` | ||
|
||
It is possible to disable signing of release artifacts directly in your build scripts (takes precedence): | ||
|
||
```groovy | ||
mavenPublish { | ||
releaseSigningEnabled = false | ||
} | ||
``` | ||
|
||
Alternatively, you can use a Gradle property which is recommended if you only want to sign certain builds | ||
or only build on certain machines. | ||
It is possible to disable signing of release artifacts by adjusting your gradle.properties like this: | ||
|
||
```groovy | ||
RELEASE_SIGNING_ENABLED=false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like that you have to specify this, why can't we do
default
always and only if you want to change it, you have to declare itThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general there are 2 reasons for this
publish
afterEvaluate
blocks, we won't be able to get rid of all of them (like when detecting which plugins are applied to the build) but at least some.With properties we can still offer easy, low overhead configuration without the cost of afterEvaluate. If you want to publish to maven central you need to add the other properties anyways so it doesn't really increase the setup cost.
The reason for not using
default
as the value when no property is present is that it won't work well with the DSL. We would then callpublishToMavenCentral(DEFAULT)
immediately and users wouldn't be able to callpublishToMavenCentral(S01)
if the prefer to use the DSL over properties.