code: public void addLicense(final String gavc, final String licenseId, final String user, final String password) throws GrapesCommunicationException, AuthenticationException{
          final Client client = getClient(user, password);
          final WebResource resource = client.resource(serverURL).path(RequestUtils.getArtifactLicensesPath(gavc));
          final ClientResponse response = resource.queryParam(ServerAPI.LICENSE_ID_PARAM, licenseId).post(ClientResponse.class);
  
          client.destroy();
          if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){
              final String message = "Failed to add license " + licenseId + " to artifact " + gavc;
              if(LOG.isErrorEnabled()) {
                  LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus()));
              }
              throw new GrapesCommunicationException(message, response.getStatus());
          }
      }
docs: Add a license to an artifact
  
  @param gavc
  @param licenseId
  @throws GrapesCommunicationException
  @throws javax.naming.AuthenticationException