def resolve_dependencies(artifacts, artifact_repositories, maven_local_repos_dir, proxy_url, proxy_username, proxy_password):
    if (len(artifacts) == 0):
        return {}
    print(('Resolving dependencies on demand: artifacts (%s) with repositories (%s)' % (artifacts, artifact_repositories)))
    if (maven_local_repos_dir is not None):
        print(('Local repository directory: %s' % maven_local_repos_dir))
    if (proxy_url is not None):
        print(('Proxy information: url (%s) username (%s)' % (proxy_url, proxy_username)))
    sys.stdout.flush()
    extrajars = get_wildcard_dir(os.path.join(STORM_TOOLS_LIB_DIR, 'submit-tools'))
    classpath = normclasspath(os.pathsep.join(extrajars))
    command = [JAVA_CMD, '-client', '-cp', classpath, 'org.apache.storm.submit.command.DependencyResolverMain']
    command.extend(['--artifacts', ','.join(artifacts)])
    command.extend(['--artifactRepositories', ','.join(artifact_repositories)])
    if (maven_local_repos_dir is not None):
        command.extend(['--mavenLocalRepositoryDirectory', maven_local_repos_dir])
    if (proxy_url is not None):
        command.extend(['--proxyUrl', proxy_url])
        if (proxy_username is not None):
            command.extend(['--proxyUsername', proxy_username])
            command.extend(['--proxyPassword', proxy_password])
    p = sub.Popen(command, stdout=sub.PIPE)
    (output, errors) = p.communicate()
    if (p.returncode != 0):
        raise RuntimeError(('dependency handler returns non-zero code: code<%s> syserr<%s>' % (p.returncode, errors)))
    if (not isinstance(output, str)):
        output = output.decode('utf-8')
    try:
        out_dict = json.loads(output)
        return out_dict
    except:
        raise RuntimeError('dependency handler returns non-json response: sysout<%s>', output)
def resolve_dependencies(artifacts, artifact_repositories, maven_local_repos_dir, proxy_url, proxy_username, proxy_password):
    if (len(artifacts) == 0):
        return {}
    print(('Resolving dependencies on demand: artifacts (%s) with repositories (%s)' % (artifacts, artifact_repositories)))
    if (maven_local_repos_dir is not None):
        print(('Local repository directory: %s' % maven_local_repos_dir))
    if (proxy_url is not None):
        print(('Proxy information: url (%s) username (%s)' % (proxy_url, proxy_username)))
    sys.stdout.flush()
    extrajars = get_wildcard_dir(os.path.join(STORM_TOOLS_LIB_DIR, 'submit-tools'))
    classpath = normclasspath(os.pathsep.join(extrajars))
    command = [JAVA_CMD, '-client', '-cp', classpath, 'org.apache.storm.submit.command.DependencyResolverMain']
    command.extend(['--artifacts', ','.join(artifacts)])
    command.extend(['--artifactRepositories', ','.join(artifact_repositories)])
    if (maven_local_repos_dir is not None):
        command.extend(['--mavenLocalRepositoryDirectory', maven_local_repos_dir])
    if (proxy_url is not None):
        command.extend(['--proxyUrl', proxy_url])
        if (proxy_username is not None):
            command.extend(['--proxyUsername', proxy_username])
            command.extend(['--proxyPassword', proxy_password])
    p = sub.Popen(command, stdout=sub.PIPE)
    (output, errors) = p.communicate()
    if (p.returncode != 0):
        raise RuntimeError(('dependency handler returns non-zero code: code<%s> syserr<%s>' % (p.returncode, errors)))
    if (not isinstance(output, str)):
        output = output.decode('utf-8')
    try:
        out_dict = json.loads(output)
        return out_dict
    except:
        raise RuntimeError('dependency handler returns non-json response: sysout<%s>', output)