JetBrains/la-clojure — Issue #6: 1.3 support for IDEA 10.5.x
Author: renekta
Created: 2011-11-22 22:21:21+00:00
State: open

I got tired of manually setting up clojure-1.3 support each time, so here's a patch that will load the jar directly from the maven site (applied against the master branch):

diff --git a/src/org/jetbrains/plugins/clojure/config/ClojureVersion.java b/src/org/jetbrains/plugins/clojure/config/ClojureVersion.java
--- a/src/org/jetbrains/plugins/clojure/config/ClojureVersion.java
+++ b/src/org/jetbrains/plugins/clojure/config/ClojureVersion.java
@@ -13,20 +13,22 @@
public enum ClojureVersion {

Clojure_1_0("1.0", new LibraryInfo[]{
- createJarDownloadInfo("clojure.jar", "", ClojureUtils.CLOJURE_MAIN),
- createJarDownloadInfo("clojure-contrib.jar", ""),
-
+ createJarDownloadInfo(true, "clojure.jar", "", ClojureUtils.CLOJURE_MAIN),
+ createJarDownloadInfo(true, "clojure-contrib.jar", ""),
}),

Clojure_1_1_0("1.1.0", new LibraryInfo[]{
- createJarDownloadInfo("clojure.jar", "1.1.0", ClojureUtils.CLOJURE_MAIN),
+ createJarDownloadInfo(true, "clojure.jar", "1.1.0", ClojureUtils.CLOJURE_MAIN),
}),

Clojure_1_2("1.2", new LibraryInfo[]{
- createJarDownloadInfo("clojure.jar", "1.2", ClojureUtils.CLOJURE_MAIN),
+ createJarDownloadInfo(true, "clojure.jar", "1.2", ClojureUtils.CLOJURE_MAIN),
+ }),
+
+ Clojure_1_3("1.3.0", new LibraryInfo[]{
+ createJarDownloadInfo(false, "clojure.jar", "1.3.0", ClojureUtils.CLOJURE_MAIN),
});

-
private final String myName;
private final LibraryInfo[] myJars;

diff --git a/src/org/jetbrains/plugins/clojure/config/util/ClojureMavenLibraryUtil.java b/src/org/jetbrains/plugins/clojure/config/util/ClojureMavenLibraryUtil.java
--- a/src/org/jetbrains/plugins/clojure/config/util/ClojureMavenLibraryUtil.java
+++ b/src/org/jetbrains/plugins/clojure/config/util/ClojureMavenLibraryUtil.java
@@ -13,14 +13,24 @@
@NonNls
private static final String DOWNLOADING_URL = DOWNLOAD_JETBRAINS_COM + "/idea/clojure/";

+ @NonNls
+ private static final String DOWNLOAD_MAVEN_ORG = "http://repo1.maven.org";
+ @NonNls
+ private static final String MAVEN_DOWNLOADING_URL = DOWNLOAD_MAVEN_ORG + "/maven2/org/clojure/clojure/";
+
private ClojureMavenLibraryUtil() {
}

- public static LibraryInfo createJarDownloadInfo(final String jarName, final String version,
+ public static LibraryInfo createJarDownloadInfo(final boolean useBrainsUrl, final String jarName, final String version,
final String... requiredClasses) {
final String v = version == null || version.length() == 0 ? "" : "/" + version + "/";
- return new LibraryInfo(jarName, DOWNLOADING_URL + v + jarName, DOWNLOAD_JETBRAINS_COM, null,
- requiredClasses);
+ if (useBrainsUrl)
+ return new LibraryInfo(jarName, DOWNLOADING_URL + v + jarName, DOWNLOAD_JETBRAINS_COM, null,
+ requiredClasses);
+ else
+ return new LibraryInfo(jarName, MAVEN_DOWNLOADING_URL + v
+ + jarName.substring(0, jarName.lastIndexOf('.')) + "-" + version + ".jar" , DOWNLOAD_MAVEN_ORG, null,
+ requiredClasses);
}

}