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.

Document how to publish packages to a maven repository

See original GitHub issue

Sorry 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:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
pun-kycommented, Nov 19, 2019

just like a said earlier … @sabberworm Gradle fixed this in 6.0.1 https://github.com/gradle/gradle/issues/11054

0reactions
pun-kycommented, Nov 21, 2019

@sabberworm heh, but it was looking promising 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publishing Java packages with Maven - GitHub Docs
You can publish your packages to both the Maven Central Repository and GitHub Packages by using the setup-java action for each registry. Ensure...
Read more >
Maven – Guide to uploading artifacts to the Central Repository
Guide to uploading artifacts to the Central Repository ... In order for users of Maven to utilize artifacts produced by your project, you...
Read more >
Publish a Java library to a Maven repository - JetBrains
Publish the library to a local Maven repository · Open the build.gradle file and add id 'maven-publish' to the plugins section. · Click...
Read more >
How to Publish Artifacts to a Maven Repository - YouTube
In this video, you'll learn how to publish project artifacts to a Maven Repository in Space Packages and share them with others.
Read more >
Maven packages in the Package Registry - GitLab Docs
Publish Maven artifacts in your project's Package Registry. Then, install the packages whenever you need to use them as a dependency. For documentation...
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