List available versions from sonatype nexus with aether-api
<p>my goal is to develop an internal tool for artifact deploying. The artifacts are located in a local repository management system (sonatype nexus). After researching, I tried to implement the task, with Aether-Api. But I failed at reprogramming one of their <a href="http://git.eclipse.org/c/aether/aether-demo.git/tree/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/FindAvailableVersions.java" rel="nofollow">examples</a> at my own. I can't evaluate the error.</p>

<pre><code>public class SourceMaven 
{
    private static RepositorySystem newRepositorySystem()
    {
        DefaultServiceLocator locator = MavenRepositorySystemUtils.newServiceLocator();
        locator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class);
        locator.addService(TransporterFactory.class, FileTransporterFactory.class);
        locator.addService(TransporterFactory.class, HttpTransporterFactory.class);

        return locator.getService(RepositorySystem.class);        
    }
    private static RepositorySystemSession newSession(RepositorySystem system)
    {
        DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
        LocalRepository localRepo = new LocalRepository("/usr/local/home/myusername/tmp/aether");
        session.setLocalRepositoryManager(system.newLocalRepositoryManager(session, localRepo));

        return session;        
    }
    private static List&lt;RemoteRepository&gt; newRepositories( RepositorySystem system, RepositorySystemSession session)
    {
        return new ArrayList&lt;RemoteRepository&gt;(Arrays.asList(newCentralRepository()));
    }
    private static RemoteRepository newCentralRepository()
    {
        return new RemoteRepository.Builder("sonanexus", "default", "http://ournexusservername:8081/nexus/#nexus").build();
    }


    public List&lt;String&gt; getReleaseList(String url) 
    {
        RepositorySystem system = newRepositorySystem();
        RepositorySystemSession session = newSession(system);

        Artifact artifact = new DefaultArtifact("org.eclipse.aether:aether-util:[0,)");

        VersionRangeRequest rangeRequest = new VersionRangeRequest();
        rangeRequest.setArtifact(artifact);
        rangeRequest.setRepositories(newRepositories(system, session));

        try 
        {
            VersionRangeResult rangeResult = system.resolveVersionRange(session, rangeRequest);
            List&lt;Version&gt; versions = rangeResult.getVersions();

            System.out.println("available versions " + versions);
        } 
            catch (VersionRangeResolutionException ex) 
        {
            System.out.println("failed ...");
        }

        return null;
    }
}
</code></pre>

<p>As output I only get an empty List without an error.</p>

<blockquote>
  <p>available versions []</p>
</blockquote>

<p>The requestested artifact coordinates are linked in our nexus and can be found in the webinterface.</p>