polishing
This commit is contained in:
@@ -86,25 +86,22 @@ public class AetherModuleResolver implements ModuleResolver {
|
||||
* @param groupId the groupId
|
||||
* @param artifactId the artifactId
|
||||
* @param extension the file extension
|
||||
* @param classifer classifier can be null if none
|
||||
* @param classifier classifier can be null if none
|
||||
* @param version the version
|
||||
* @return a {@ link FileSystemResource} representing the resolved artifact in the local repository
|
||||
* @throws a RuntimeException if the artifact does not exist or the resolution fails
|
||||
*/
|
||||
@Override
|
||||
public Resource resolve(String groupId, String artifactId, String extension, String classifer, String version) {
|
||||
public Resource resolve(String groupId, String artifactId, String extension, String classifier, String version) {
|
||||
Assert.hasText(groupId, "'groupId' cannot be blank.");
|
||||
Assert.hasText(artifactId, "'artifactId' cannot be blank.");
|
||||
|
||||
Assert.hasText(extension, "'extension' cannot be blank.");
|
||||
|
||||
if (classifer == null) {
|
||||
classifer = "";
|
||||
if (classifier == null) {
|
||||
classifier = "";
|
||||
}
|
||||
|
||||
Assert.hasText(version, "'version' cannot be blank.");
|
||||
|
||||
Artifact artifact = new DefaultArtifact(groupId, artifactId, classifer, extension, version);
|
||||
Artifact artifact = new DefaultArtifact(groupId, artifactId, classifier, extension, version);
|
||||
RepositorySystemSession session = newRepositorySystemSession(repositorySystem,
|
||||
localRepository.getAbsolutePath());
|
||||
ArtifactResult result;
|
||||
|
||||
@@ -31,10 +31,10 @@ public interface ModuleResolver {
|
||||
* @param groupId the groupId
|
||||
* @param artifactId the artifactId
|
||||
* @param extension the file extension
|
||||
* @param classifer classifier
|
||||
* @param classifier classifier
|
||||
* @param version the version
|
||||
* @return the resource
|
||||
*/
|
||||
public Resource resolve(String groupId, String artifactId, String extension, String classifer, String version);
|
||||
public Resource resolve(String groupId, String artifactId, String extension, String classifier, String version);
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AetherModuleResolverTests {
|
||||
ClassPathResource cpr = new ClassPathResource("local-repo");
|
||||
File localRepository = cpr.getFile();
|
||||
AetherModuleResolver defaultModuleResolver = new AetherModuleResolver(localRepository, null);
|
||||
Resource resource = defaultModuleResolver.resolve("foo.bar", "foo-bar", "jar","","1.0.0");
|
||||
Resource resource = defaultModuleResolver.resolve("foo.bar", "foo-bar", "jar", "", "1.0.0");
|
||||
assertTrue(resource.exists());
|
||||
assertEquals(resource.getFile().getName(), "foo-bar-1.0.0.jar");
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class AetherModuleResolverTests {
|
||||
ClassPathResource cpr = new ClassPathResource("local-repo");
|
||||
File localRepository = cpr.getFile();
|
||||
AetherModuleResolver defaultModuleResolver = new AetherModuleResolver(localRepository, null);
|
||||
defaultModuleResolver.resolve("niente", "nada", "jar","", "zilch");
|
||||
defaultModuleResolver.resolve("niente", "nada", "jar", "", "zilch");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -92,7 +92,7 @@ public class AetherModuleResolverTests {
|
||||
.withStatus(200)
|
||||
.withBodyFile(stubFileName)));
|
||||
AetherModuleResolver defaultModuleResolver = new AetherModuleResolver(localRepository, remoteRepos);
|
||||
Resource resource = defaultModuleResolver.resolve("org.bar", "foo","jar", "", "1.0.0");
|
||||
Resource resource = defaultModuleResolver.resolve("org.bar", "foo", "jar", "", "1.0.0");
|
||||
assertTrue(resource.exists());
|
||||
assertEquals(resource.getFile().getName(), "foo-1.0.0.jar");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user