- client.disconnect();
- } catch (NexusClientException | NexusConnectionException e) {
- LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "failed to disconnect Connection from Nexus." +e.getMessage());
+ String repURL = repURLs.get(0);
+ client.connect(repURL.substring(0, repURL.indexOf(repURL.split(":[0-9]+\\/nexus")[1])), repUserName, repPassword);
+ final NexusArtifact template = new NexusArtifact();
+ template.setGroupId(getGroupID(selectedName));
+ template.setArtifactId(getArtifactID(selectedName));
+ if(version!=null){
+ template.setVersion(version);
+ }
+ List<NexusArtifact> resultList = client.searchByGAV(template);
+ if(resultList!=null){
+ flag = true;
+ return resultList;
+ }
+ } catch (NexusClientException | NexusConnectionException | NullPointerException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Connection to remote Nexus has failed. " +e.getMessage());
+ } finally {
+ try {
+ client.disconnect();
+ } catch (NexusClientException | NexusConnectionException e) {
+ LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "failed to disconnect Connection from Nexus." +e.getMessage());
+ }
+ if(!flag){
+ Collections.rotate(repURLs, -1);
+ i++;
+ }