The assets have identical coordinates

Hi there,

I tried to migrate my artefacts from Nexus 3.11 to nexus 3.25.1. To do that I wrote a simple Python Script, that download my artefacts from a given repository, and then push them into my new Nexus.
But my artefacts are multi assets, and then, when I tried to upload the artefacts, it return a 400 error.

Looking to the log I can see this kind of message

 The assets 13 and 14 have identical coordinates

This is what my function looks like

Is there some params I can use in my POST request to force upload ?

Thx for your help

Regards
Vincent JOBARD

1 Like

Hi Vincent,

I had the same issue and I finally fix with something like below

you need to add a classifier


payload = {
                        'maven2.groupId': (None, each_comp['group']),
                        'maven2.artifactId': (None, each_comp['name']),
                        'maven2.version': (None, each_comp['version']),
                        'maven2.generate-pom': (None, 'false'),

                }

def fill_payload():
 url = f'{NEXUS_FROM}/service/rest/v1/components?repository={args.repo}' + '&continuationToken=' + token
    while True: # somehitng to keep pagination
        response = session.get(url, verify=False)
        data = response.json()
        for each in data['items']:
            for asset_req in each['assets']:
                 payload[f'maven2.asset{count_asset}'] = (filename, asset_req.content)
                 payload[f'maven2.asset{count_asset}.extension'] = (None, asset['maven2']['extension'])
                 if 'classifier' in asset['maven2'].keys(): #from API component list
                     payload[f'maven2.asset{count_asset}.classifier'] = (None, asset['maven2']['classifier'])
    
def send_to_nexus_dest(payload):
    url = f'{NEXUS_DEST}/service/rest/v1/components'
    params = (
            ('repository', args.repo),
    )
    response = session.post(url,
         allow_redirects = False,
         params = params,
         files = payload,
         timeout = 200,
         verify = False,
         headers = {'Connection':'close'})

    logging.debug(f'Upload Response : {response}')
    #print(response.json())

    return True