Can't build La Clojure from source

I've downloaded the source zip for La Clojure and opened it in IDEA as a plugin project.  I've created an IntelliJ SDK and configured it as the module SDK but I'm seeing loads of unresolved imports.  Some examples below:

com.intellij.execution.impl.DisposedPsiManagerCheck
com.intellij.openapi.editor.ex.EditorEx
com.intellij.openapi.editor.ex.MarkupModelEx
com.intellij.openapi.diff.actions.DiffActions
...

I'm using 8.1.3 (build 9886).  Am I missing something obvious?

Thanks
Chris

12 comments

Hi, Chris.

You should attach idea.jar to your IDEA SDK manually. Normally it's located in the $IDEA_HOME folder. To build plugin via ant you need to change clojure.properties file in the project root to point to Java location and IDEA homw directory.

Cheers,
Ilya

0

I hadn't realised the source was available - nice.  I found the zip file but is there a public source repository where it lives?

0

Public plugin repository is located here: http://svn.jetbrains.org/idea/Trunk/clojure-plugin
but we don't upload zipped build to it. One should build it from scratc, as usual, by the `ant' command.

Cheers,
Ilya

0

Thanks, that was it.  You also need to manually add tools.jar from the JDK for the com.sun.jdi classes.

Cheers
Chris

0

I checked out the SVN version and there was some weirdness with ClojurePsiElementFactory so I copied it across from the zipped version.  After that it built and ran fine in IDEA but not using Ant. It looks from the error message like the openapi jar is built using Java 6.  Does that seem likely?

[javac2] [loading c:\bin\idea-8.1.3\lib\openapi.jar(com/intellij/openapi/application/ApplicationManager.class)]
[javac2] C:\tmp\la-clojure\src\org\jetbrains\plugins\clojure\ClojureApplication.java:3: cannot access com.intellij.openapi.application.ApplicationManager
[javac2] bad class file: c:\bin\idea-8.1.3\lib\openapi.jar(com/intellij/openapi/application/ApplicationManager.class)
[javac2] class file has wrong version 50.0, should be 49.0
[javac2] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac2] import com.intellij.openapi.application.ApplicationManager;
[javac2]                                         ^
[javac2] [total 2266ms]
[javac2] 1 error

0

It looks like openapi is compiled for Java 6:

C:\tmp\la-clojure>javap -verbose -classpath c:\bin\idea-8.1.3\lib\openapi.jar com.intellij.openapi.application.ApplicationManager
Compiled from "ApplicationManager.java"
public class com.intellij.openapi.application.ApplicationManager extends java.lang.Object
  SourceFile: "ApplicationManager.java"
  minor version: 0
  major version: 50

Does this mean it's not possible to compile plugins targeting Java 5 with this version?  My main machine is a G5 Mac so I'm stuck on Java 5.

0

Yes, now the plugin is built via Java version 1.6 but with 1.5 as a target one.

Cheers,
Ilya

0

I'm trying to build using Java 6 and Ant but I can't get it to work.  That's what the error in my earlier post was about:

[javac2] bad class file: c:\bin\idea-8.1.3\lib\openapi.jar(com/intellij/openapi/application/ApplicationManager.class)
[javac2] class file has wrong version 50.0, should be 49.0
[javac2] Please remove or make sure it appears in the correct subdirectory of the classpath.

I'm using the following in clojure.properties
idea.home=c:/bin/idea-8.1.3
java.home=c:/Program Files/Java/jdk1.6.0_11

I'm trying to build the latest SVN version under Windows XP.  I'm guessing the compiler is complaining because the target is 1.5 but the openapi.jar contains 1.6 class files (version 50).  But javac2 is an IntelliJ task so I'm not sure.  Any suggestions?

Thanks
Chris

0

I would recommend you to use EAP IDEA version which is built with Java 1.5. It may be downloaded from http://www.jetbrains.net/confluence/display/IDEADEV/Diana+EAP.

Cheers,
Ilya

0

OK, I'll try that tomorrow when I'm in front of a Windows machine.  But doesn't that mean any Windows users with a non-EAP build can't build plugins that target Java 5?  Shouldn't the API jar always be built for Java 5 even if the rest of the code is built for Java 6?

Chris

0

I've compiled it successfully on a Mac running Java 5 and it seems to work fine.  The only problem is with ClojurePsiElementFactory.java.  There's something weird going on with the Subversion repository.  Command-line svn fails when it reaches that file and if you check the code out using IDEA that file is missing.  I had to get it from the source zip and copy it into the subversion code by hand.

Chris

0

The weirdness is that plugins/clojure/psi/util has two copies of the same file in different cases (ClojurePsiElementFactory.java and ClojurePsiElementfactory.java).

see: http://svn.jetbrains.org/idea/Trunk/clojure-plugin/src/org/jetbrains/plugins/clojure/psi/util

SVN on OSX hates that.

I've been trying to build this too, the process is extremely mac-unfriendly. For me, it went like:

1. Download source from plugin page.
2. Open plugin with 9.0M1.
3. Install JFlex plugin.
4. Get exception on starting because JFlex is built with Java 6.
5. Get JFlex source to build from source with 1.5, realise it's not 9.0 ready.
6. Open it in 8.1.3, compile and install.
7. Jump through some hoops, realise it just doesn't work after reading http://www.jetbrains.net/devnet/thread/276337, so uninstall it.
8. Try to compile La Clojure, get some weird errors compiling the code in lib/jvm (a bunch of ISeq implementations don't implement next()).
9. Try to download from svn repo above, get bizarre SVN error (svn: Can't copy 'clojure-plugin/src/org/jetbrains/plugins/clojure/psi/util/.svn/tmp/text-base/ClojurePsiElementfactory.java.svn-base' to 'clojure-plugin/src/org/jetbrains/plugins/clojure/psi/util/.svn/tmp/ClojurePsiElementfactory.java.tmp.tmp': No such file or directory)
10. Download repo using Idea, realise that CPEF is missing.
11. Notice by chance that it tried to download two copies on the command line and fix it.
12. Finally get it to compile.

I mean, I know we're all developers, but that's a long way from a seamless experience.

Cheers,
Colin

0

Please sign in to leave a comment.