Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Treat special urls like "mvn" and "mvn:" (without arguments) the same

  • Loading branch information...
commit 154d739a22de729c538ee5a2330017f752d7cfb6 1 parent 0d62fba
@quintesse quintesse authored
View
2  ceylon/src/main/java/com/redhat/ceylon/cmr/ceylon/CeylonUtils.java
@@ -402,7 +402,7 @@ private boolean isHTTP(String repo) {
private boolean isRemote(String repo) {
// IMPORTANT Make sure this is consistent with RepositoryBuilderImpl.buildRepository() !
// (except for "file:" which we don't support)
- return isHTTP(repo) || repo.startsWith("mvn:") || "mvn".equals(repo) || "aether".equals(repo) || repo.startsWith("aether:") || repo.equals("jdk");
+ return isHTTP(repo) || "mvn".equals(repo) || repo.startsWith("mvn:") || "aether".equals(repo) || repo.startsWith("aether:") || repo.equals("jdk") || repo.equals("jdk:");
}
}
View
32 impl/src/main/java/com/redhat/ceylon/cmr/impl/RepositoryBuilderImpl.java
@@ -17,15 +17,15 @@
package com.redhat.ceylon.cmr.impl;
+import java.io.File;
+import java.lang.reflect.Method;
+import java.net.URI;
+
import com.redhat.ceylon.cmr.api.Logger;
import com.redhat.ceylon.cmr.api.Repository;
import com.redhat.ceylon.cmr.api.RepositoryBuilder;
import com.redhat.ceylon.cmr.spi.StructureBuilder;
-import java.io.File;
-import java.lang.reflect.Method;
-import java.net.URI;
-
/**
* Repository builder.
*
@@ -53,23 +53,21 @@ public Repository buildRepository(String token) throws Exception {
StructureBuilder structureBuilder;
if (token.startsWith("http:") || token.startsWith("https:")) {
structureBuilder = new RemoteContentStore(token, log);
+ } else if (token.equals("mvn") || token.equals("mvn:")) {
+ return MavenRepositoryHelper.getMavenRepository();
} else if (token.startsWith("mvn:")) {
return MavenRepositoryHelper.getMavenRepository(token.substring("mvn:".length()), log);
- } else if (token.equals("mvn")) {
- return MavenRepositoryHelper.getMavenRepository();
- } else if (token.equals("jdk")) {
+ } else if (token.equals("jdk") || token.equals("jdk:")) {
return new JDKRepository();
- } else if (token.equals("aether") || token.startsWith("aether:")) {
+ } else if (token.equals("aether") || token.equals("aether:")) {
+ Class<?> aetherRepositoryClass = Class.forName("com.redhat.ceylon.cmr.maven.AetherRepository");
+ Method createRepository = aetherRepositoryClass.getMethod("createRepository", Logger.class);
+ return (Repository) createRepository.invoke(null, log);
+ } else if (token.startsWith("aether:")) {
+ String settingsXml = token.substring("aether:".length());
Class<?> aetherRepositoryClass = Class.forName("com.redhat.ceylon.cmr.maven.AetherRepository");
- if (token.equals("aether")) {
- Method createRepository = aetherRepositoryClass.getMethod("createRepository", Logger.class);
- return (Repository) createRepository.invoke(null, log);
- }
- else {
- String settingsXml = token.substring("aether:".length());
- Method createRepository = aetherRepositoryClass.getMethod("createRepository", Logger.class, String.class);
- return (Repository) createRepository.invoke(null, log, settingsXml);
- }
+ Method createRepository = aetherRepositoryClass.getMethod("createRepository", Logger.class, String.class);
+ return (Repository) createRepository.invoke(null, log, settingsXml);
} else {
final File file = (token.startsWith("file:") ? new File(new URI(token)) : new File(token));
if (file.exists() == false)
Please sign in to comment.
Something went wrong with that request. Please try again.