How to avoid json file automatically adding to upload archives configuration instead of custom configuration?

plugins
(SASISEKAR ANGAMUTHU) #1

I am using maven plugin for uploading artifacts to repository.
We have used two configurations to upload file into multiple repositories.

Configuration archives is used to upload jar files to repository 1.
Configuration apispec is used to upload json files to repository 2.

used below line to upload json using apispec.
def jsonArtifact = new DefaultPublishArtifact(file.getName(), "json", "json", null, new Date(), file) configurations.apiSpecs.getArtifacts().add(jsonArtifact)

or

apiSpecs file: file, name: file.getName(), type: 'json'

But this adding artifact to the apiSpecs and archives configuration as well. Due to that file is getting uploaded to both repositories.

Could someone guide me on this? Thanks

0 Likes

(SASISEKAR ANGAMUTHU) #2

I still haven’t managed to get it working. Can someone help me?

0 Likes

(Knolle) #3

Adding an artifact to a custom configuration will also add it to the archives config. Unfortunately this fact is not really documented.
As a solution you could just define 2 custom configurations and only publish those.

1 Like