How can I search a specific artifact in Aether?
Dependency dependency =
new Dependency( new DefaultArtifact( "com.google.code.gson:gson:war:sources:2.5" ), "compile" );
RemoteRepository central = new RemoteRepository.Builder( "central", "default", "http://repo1.maven.org/maven2/" ).build();
CollectRequest collectRequest = new CollectRequest();
collectRequest.setRoot( dependency );
collectRequest.addRepository( central );
DependencyNode node = repoSystem.collectDependencies( session, collectRequest ).getRoot();
DependencyRequest dependencyRequest = new DependencyRequest();
dependencyRequest.setRoot( node );
repoSystem.resolveDependencies( session, dependencyRequest );
PreorderNodeListGenerator nlg = new PreorderNodeListGenerator();
node.accept( nlg );
System.out.println( nlg.getClassPath() );
At first, I want to search all "gson" in RemoteRepository and get result with all information then download it. But how? In this example, I must set correct one and download it.
You can't search for artifacts by name with Aether or Maven.
If you want a search engine, try http://search.maven.org. There's also a REST API.