Document how to publish packages to a maven repository
See original GitHub issueSorry if this has come up before or if it’s documented somewhere but I couldn’t figure out how to publish a generated content package to a maven repository.
If I understood everything correctly, the following should do that:
configure<PublishingExtension> {
publications {
create<MavenPublication>("aemPackage") {
artifact(project.tasks.named("packageCompose"))
}
}
}
However this results in the following error during configuration:
* What went wrong:
Cannot convert the provided notation to an object of type MavenArtifact: task ':packageCompose'.
The following types/formats are supported:
- Instances of MavenArtifact.
- Instances of AbstractArchiveTask, for example jar.
- Instances of PublishArtifact
- Maps containing a 'source' entry, for example [source: '/path/to/file', extension: 'zip'].
- Anything that can be converted to a file, as per Project.file()
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
This message confuses me since clearly :packageCompose
is a task that inherits from com.cognifide.gradle.aem.common.tasks.ZipTask
, which inherits from org.gradle.api.tasks.bundling.Zip
, which, in turn, inherits from AbstractArchiveTask
, as required.
I’m not sure if this is an issue with the gradle-aem-plugin or the maven-publishing plugin. I suspect this is not a bug but simply a misconfiguration on my part but I think it’s a common-enough use-case that it needs to be documented.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
just like a said earlier … @sabberworm Gradle fixed this in 6.0.1 https://github.com/gradle/gradle/issues/11054
@sabberworm heh, but it was looking promising 😉