public List<MavenArtifact> search(
     String nexusUrl,
     String userName,
     String password,
     String repositoryId,
     String groupIdToSearch,
     String artifactId,
     String versionToSearch)
     throws Exception {
   return NexusServerUtils.search(
       nexusUrl, userName, password, repositoryId, groupIdToSearch, artifactId, versionToSearch);
 }
  public NexusServerBean getCustomNexusServer() {
    NexusServerBean serverBean = null;
    try {
      IProxyRepositoryFactory factory = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory();
      RepositoryContext repositoryContext = factory.getRepositoryContext();
      if (factory.isLocalConnectionProvider() || repositoryContext.isOffline()) {
        return null;
      }
      if (repositoryContext != null && repositoryContext.getFields() != null) {
        String adminUrl = repositoryContext.getFields().get(RepositoryConstants.REPOSITORY_URL);
        String userName = "";
        String password = "";
        User user = repositoryContext.getUser();
        if (user != null) {
          userName = user.getLogin();
          password = repositoryContext.getClearPassword();
        }

        if (adminUrl != null
            && !"".equals(adminUrl)
            && GlobalServiceRegister.getDefault().isServiceRegistered(IRemoteService.class)) {
          IRemoteService remoteService =
              (IRemoteService) GlobalServiceRegister.getDefault().getService(IRemoteService.class);
          JSONObject libServerObject;
          libServerObject = remoteService.getLibNexusServer(userName, password, adminUrl);
          if (libServerObject != null) {
            String nexus_url = libServerObject.getString(NexusServerUtils.KEY_NEXUS_RUL);
            String nexus_user = libServerObject.getString(NexusServerUtils.KEY_NEXUS_USER);
            String nexus_pass = libServerObject.getString(NexusServerUtils.KEY_NEXUS_PASS);
            String repositoryId =
                libServerObject.getString(NexusServerUtils.KEY_CUSTOM_LIB_REPOSITORY);

            // TODO check if custom nexus is valid , only check http response for now , need check
            // if it is
            // snapshot latter
            boolean connectionOk =
                NexusServerUtils.checkConnectionStatus(
                    nexus_url, repositoryId, nexus_user, nexus_pass);
            if (!connectionOk) {
              return null;
            }

            String newUrl = nexus_url;
            if (newUrl.endsWith(NexusConstants.SLASH)) {
              newUrl = newUrl.substring(0, newUrl.length() - 1);
            }
            if (nexus_user != null && !"".equals(nexus_user)) { // $NON-NLS-1$
              String[] split = newUrl.split("://"); // $NON-NLS-1$
              if (split.length != 2) {
                throw new RuntimeException(
                    "Nexus url is not valid ,please contract the administrator");
              }
              newUrl =
                  split[0]
                      + ":"
                      + nexus_user
                      + ":"
                      + nexus_pass
                      + "@//" //$NON-NLS-1$
                      + split[1];
            }
            newUrl =
                newUrl
                    + NexusConstants.CONTENT_REPOSITORIES
                    + repositoryId
                    + "@id="
                    + repositoryId; //$NON-NLS-1$

            serverBean = new NexusServerBean();
            serverBean.setServer(nexus_url);
            serverBean.setUserName(nexus_user);
            serverBean.setPassword(nexus_pass);
            serverBean.setRepositoryId(repositoryId);
            serverBean.setRepositoryUrl(newUrl);
          }
        }
      }
    } catch (Exception e) {
      serverBean = null;
      ExceptionHandler.process(e);
    }
    if (previousCustomBean == null && serverBean != null
        || previousCustomBean != null && !previousCustomBean.equals(serverBean)) {
      mavenResolver = null;
    }
    previousCustomBean = serverBean;
    return serverBean;
  }