### Question:
ProcessorpathResolver { public List<File> resolve(RepositorySystemSession session, MavenProject project, List<Dependency> dependencies) throws MojoExecutionException { ArtifactTypeRegistry stereotypes = session.getArtifactTypeRegistry(); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRootArtifact(RepositoryUtils.toArtifact(project.getArtifact())); collectRequest.setRequestContext("project"); collectRequest.setRepositories(project.getRemoteProjectRepositories()); Map<String, Artifact> artifacts = project.getArtifactMap(); for (Dependency dependency : dependencies) { if (Strings.isNullOrEmpty(dependency.getVersion())) { Artifact artifact = artifacts.get(ArtifactUtils.versionlessKey(dependency.getGroupId(), dependency.getArtifactId())); if (artifact != null) { dependency = dependency.clone(); dependency.setVersion(artifact.getVersion()); } } collectRequest.addDependency(RepositoryUtils.toDependency(dependency, stereotypes)); } DependencyManagement depMngt = project.getDependencyManagement(); if (depMngt != null) { for (Dependency dependency : depMngt.getDependencies()) { collectRequest.addManagedDependency(RepositoryUtils.toDependency(dependency, stereotypes)); } } DependencyFilter collectionFilter = new ScopeDependencyFilter(null, Collections.singleton("test")); DependencyFilter resolutionFilter = new ScopeDependencyFilter(null, Collections.singleton("test")); resolutionFilter = AndDependencyFilter.newInstance(collectionFilter, resolutionFilter); DependencyRequest depRequest = new DependencyRequest(collectRequest, resolutionFilter); try { DependencyNode node = aether.collectDependencies(session, collectRequest).getRoot(); depRequest.setRoot(node); List<File> processorpath = new ArrayList<>(); List<Exception> errors = new ArrayList<>(); for (ArtifactResult artifactResult : aether.resolveDependencies(session, depRequest).getArtifactResults()) { if (artifactResult.isResolved()) { processorpath.add(artifactResult.getArtifact().getFile()); } else { errors.addAll(artifactResult.getExceptions()); } } if (!errors.isEmpty()) { StringBuilder msg = new StringBuilder(); errors.forEach(e -> msg.append(e.getMessage()).append(", ")); throw new MojoExecutionException("Could not resolve processorpath: "); } return processorpath; } catch (DependencyCollectionException | DependencyResolutionException e) { throw new MojoExecutionException("Could not resolve processorpath: " + e.getMessage(), e); } } @Inject  ProcessorpathResolver(RepositorySystem aether); List<File> resolve(RepositorySystemSession session, MavenProject project, List<Dependency> dependencies);  }### Answer:
@Test public void testVersionlessDependency() throws Exception { File basedir = resources.getBasedir(); MavenProject project = maven.readMavenProject(basedir); maven.newDependency(temp.newFile()).setGroupId("g").setArtifactId("a").setVersion("1").addTo(project); MavenSession mavenSession = maven.newMavenSession(project); RepositorySystemSession repoSession = mavenSession.getRepositorySession(); SimpleReactorReader.builder() .addArtifact("g:a:1", temp.newFile()) .addArtifact("g:a:pom:1", temp.newFile()) .toSession(repoSession); ProcessorpathResolver resolver = maven.lookup(ProcessorpathResolver.class); List<File> processorpath = resolver.resolve(repoSession, project, dependencies("g:a")); assertEquals(1, processorpath.size()); assertTrue(processorpath.get(0).isFile()); }