Skip to content
Advertisement

Artifactory + Custom Gradle Plugin Programmatically (2022)

I’m trying to create a custom gradle plugin (100% java) which will automatically configure Artifactory, avoiding the need of the following DSL:

JavaScript

I’m trying to re-create @agrosner own solution (from https://stackoverflow.com/a/25669431/1880280) but I’m missing “ArtifactoryAction”. I can’t find it anywhere.

The nonworking version posted by @agrosner is the following code:

JavaScript

Can anyone help with an updated 100% java version of this?

Additionally, how would be for the following DSL?

JavaScript

Thanks in advance

César

ps. The DSL version that was published at @agrosner question thread is not useful for me. I need a Java version.

Advertisement

Answer

For your first question related to ArtifactoryAction: this is neither Gradle API nor Artifactory plugin related api, but most probably a custom class that the response author has implemented himself, as a shortcut to declare his custom Artifactory maven repo.

See this API, used to declare maven repositories :

JavaScript

So you can use:

JavaScript

or wrap the action code into a custom implementation of Action<? super MavenArtifactRepository> :

JavaScript

For the other question with java translation of the artifactory { } DSL : see full example below with some inline comments. ( not tested but translated from my kotlin implementation which works fine)

JavaScript

EDIT for the publication configuration, you can do as follows:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement