cdancy/artifactory-rest

org.jclouds.io.Payload is missing when declaring artifactory-rest as a dependency

Closed this issue · 2 comments

When a project depends on artifactory-rest and tries to use the ArtifactApi.deployArtifact(), the user of the library must also declare a dependency on org.apache.jclouds:jclouds-core because the API of that method uses org.jclouds.io.Payload.

The method signature is:

Artifact deployArtifact(
    @PathParam("repoKey") String repoKey,
    @PathParam("itemPath") String itemPath,
    Payload inputStream,
    @Nullable @BinderParam(BindMatrixPropertiesToPath.class) Map<String, List<String>> properties);

The type of the 3rd argument is org.jclouds.io.Payload. So to use this method, users must also declare a dependency on org.apache.jclouds:jcloud-core.

Instead, I would like to propose to expose the jclouds dependency as an api using gradle's api configuration. I am studying the problem and working on a PR and I hope to send it in soon.

I would like to find a way to test it too, but I just begin to understand these concepts!

CC @Dhivyaa21

So what works is to declare jclouds-core using the api configuration provided by the java-library plugin:

plugins {
    id 'java-library'
}

// ...
dependencies {
    // ...
    api ("org.apache.jclouds:jclouds-core:${jcloudsVersion")
    // ....
}

But I am also trying to create a test to prove that's the only element needed to be in the api configuration.

I agree with @martinda. The problem with implementation configuration is that the dependencies are not available during the compile time. However, gradle adds them with a runtime scope in the pom.xml. Since this project will be used as a dependency in other projects, it is better to use api for jclouds-core.