Tag Archives: IntelliJ Idea

Improved IntelliJ IDEA startup script for Linux

Here is an improved version of the IntelliJ IDEA startup script distributed along with the tar.gz for Linux. Why am I saying it is an improvement? Because this script will allow you to create symbolic links to it, so you can have it in your PATH without having yo set/alter other environment variables:

if [ -z "$IDEA_HOME" -o ! -d "$IDEA_HOME" ] ; then
   PRG="$0"
   progname=`basename "$0"`

   while [ -h "$PRG" ] ; do
       ls=`ls -ld "$PRG"`
       link=`expr "$ls" : '.*-> \(.*\)$'`
       if expr "$link" : '/.*' > /dev/null; then
           PRG="$link"
       else
           PRG=`dirname "$PRG"`"/$link"
       fi
   done

   IDEA_HOME=`dirname "$PRG"`/..
   IDEA_HOME=`cd "$IDEA_HOME" && pwd`
fi

#IDEA_HOME=`dirname "$0"`/..
#IDEA_BIN_HOME=`dirname "$0"`
IDEA_BIN_HOME=$IDEA_HOME

REQUIRED_JVM_ARGS="-Xbootclasspath/p:$IDEA_HOME/lib/boot.jar: $IDEA_PROPERTIES_PROPERTY"

CLASSPATH=$IDEA_HOME/lib/idea.jar
CLASSPATH=$CLASSPATH:$IDEA_HOME/lib/openapi.jar
CLASSPATH=$CLASSPATH:$IDEA_HOME/lib/jdom.jar
CLASSPATH=$CLASSPATH:$IDEA_HOME/lib/log4j.jar
CLASSPATH=$CLASSPATH:$IDEA_HOME/lib/extensions.jar
CLASSPATH=$CLASSPATH:$IDEA_JDK/lib/tools.jar
CLASSPATH=$CLASSPATH:$IDEA_CLASSPATH

and having in mind that the java process in now started in $IDEA_HOME then a small modification is needed in log.xml: from <!DOCTYPE log4j:configuration SYSTEM "file:./log4j.dtd"> to <!DOCTYPE log4j:configuration SYSTEM "file:bin/log4j.dtd">

Hope you find it usefull. I will probably suggest it also on the IntelliJ Idea JIRA

Leave a comment

Filed under Uncategorized

Sharing IDEA project definition files

In a previous post I have tried to figure out how Idea project and modules definition files can be shared between team members considering etherogenous environments.
While I could find a few references in the Help, none of them is really describing how things should be done. I have mentioned how this can be achieved while working with Eclipse by using path variables. This same notion exists in Idea too, but I couldn’t figure out how can one can use it from the UI. But, the good news is that you can define variables to be used with modules, and also you can use variables while defining classpaths. I have figured out that by editting the .ipr file (project definition) and adding:

<UsedPathMacros>
<macro name=”MAVEN_REPO” />
</UsedPathMacros>

you will force your project to define this variable and than you can use it in both module paths and different classpaths just by specifying $MAVEN_REPO$/rest_of_path. The only thing left is to find out how you can do this without having to manually edit the .ipr and .iml files. Does anybody know the answer to this?

Disclaimer: this is the 3rd post in row about Idea and considering what may happen if Hani is picking you, I will just let everybody know that I am not associated and nor do I work for Eclipse or Idea.

category: , ,

1 Comment

Filed under Uncategorized

An Eclipse user in IDEA-land meets paths

If you haven’t followed the first part of this series, I will briefly restate here that the goal of these posts is not to start the long discussion about which IDE is better, but rather to raise some questions about things that remained unclear while playing with Idea.

Today the Eclipse user (n.b.: me) had to play with paths. And I am including here: source paths, output paths and classpaths.
First: source paths. In Eclipse I have to define the source folders under the current project directory. The only possibility to include in a project external source dirs is through linked directories. Idea allows providing more Content Roots for each module, and so you can include multiple source directories from different locations on the file system.
Output paths: Idea allows you to set only 2 output directories per module: the source output directory and the test output directory. Even if at the first glance this looks a little bit restrictive, things are not so bad cause for real big projects requiring multiple output folders you will however have to define a build system (Ant, Maven based) to really manage the project.
So far, everything went as expected. Unfortunately, the things weren’t as clear while trying to set the classpath. In a multi-module project, Idea introduces 3 types of classpaths: Global libraries, Project libraries and Module libraries. While at the first glance these look really good, I finally haven’t been able to achieve what I wanted.

And I think this is the moment for the first question: considering a project that is shared by a team of developers, and the project is built using jars from a MAVEN local repository (each developer may have the repository on a different location), how should I define the classpath so that the project/module definition can be shared? Or, what is the correct approach for achieving this with Idea. In Eclipse I am doing this using a variable pointing to MAVEN_REPO and than defining the classpath in terms of this variable (the classpath will look something like: MAVEN_REPO/log4j/jars/log4j-1.2.8.jar;MAVEN_REPO/lucene/jars/lucene-1.4.3.jar. Considering that each developer can define this variable to point to his repository than the team will be able to share the project definition file). Can this be achieved with Idea?

In Eclipse I can include a jar in my project classpath using one of the following solutions:

  • contained in the current project (the most usual way)
  • anywhere on the filesystem (not very usefully in a shared project)
  • extended variable (as shown above)
  • relative to another project (very usefully in a shared project: the classpath description is persisted in relative terms ignoring the real locations of the projects)

My final question for the 2nd day in the Idea-land would be: how can I achieve the 3rd and 4th scenarios in the above list, and also be assured that the project/module definition can be shared. I really hope to have some answers from expert Idea users, so that I will have a 3rd day in Idea-land. Thanks.

category: , ,

2 Comments

Filed under Uncategorized

IDE advantage (or Ruby experiences)

Listening to my friend Cedric advice and considering all the talks about RoR, a few months ago I have decided to start looking and reading about Ruby.
I haven’t done much scripting before and discovering this OO scripting language is an interesting experience. However, coming from the Java world, my expectations are different; and I am not speaking at the language level, but at the tools level.
Right from the beginning I was asking on Ruby mailing list which editors/IDEs are they using? How are they organizing/managing the sources? How is the maintainance gonna work?

Well, the first question has generated a lot of traffic, with the conclusion that you don’t need a specialized editor/IDE, just some coloring and folding and some tricks to fire irb it’s just enough. I have gonne further and asked what about big projects with thousand of sources? This almost started another flame which concluded with the fact that Ruby source code is much more less than Java code and again you don’t need an IDE for it. I tended to distrust these reasons, as I was remembering my early days with Java when doing small projects with vim was fun, but comming back after a few months was a killer, and I bought a license of Arachno Ruby. I did some research in advance and finally I have concluded that this is the kind of editor that is gonna help me out with Ruby going to the directions I liked.
Making the story short and coming back to nowadays, today I have installed a desktop wiki in Ruby: Socks. It is a very nice and small wiki offering a lot of features. However I have disliked one or two of its offerings and one that I was looking for (page tagging) was missing, so I decided it is the right moment to dig for the first time in Ruby.
The project is indeed small compaired with a Java project: 36 sources. The first bad sign for my playtime were the files with more than 1000 lines. Than immediately a question raised in my head: how am I suppose to find the source of a class/module definition? In my Eclipse IDE I have been pressing F3 for a couple of times and the navigation was done. But here? I have to use find and sed and grep, forgetting that I am on an Win machine (hint! hint! Lothar).
I will not make this entry any longer, but I finished by asking myself how can you really be more productive in Ruby? Maybe if you write all your code by your own and maintain it permanently. Otherwise I cannot see how using such a diversity of tools just to accomplish an easy task can make you more productive.

Disclaimer: I definitely don’t have the Ruby mindset yet. Hope to find it soon.

Update: a small update about Arachno Ruby: it has a Lookup Selection function that may help you while doing navigation. Thanks a lot Lothar.

4 Comments

Filed under Tools

TestNG plugin for IDEA – help needed

Hi!

I would like to know if somebody out there would be interested in starting a TestNG plugin for
IntelliJ IDEA. My knowledge of Idea API is almost 0 (and their plugin development distro left me at
exactly the same level), but I would gladly help to have this task done.

If anybody is interested in doing this, please drop me an email to plan it out.

Thanks in advance and I really hope that somebody will help me out.

1 Comment

Filed under Uncategorized

TestNG and IDE support

During the last months, while developing TestNG, I have read and also received lots of comments about the lack of support for TestNG in the most used IDEs (Eclipse, IntelliJ IDEA and NetBeans). I have put some of my spare time into developing a plugin for Eclipse (by the way it is working great, and the features are quite nice [blink/]). I’ve had intentions to do the same for Idea, but I cannot see how I can develop a plugin with the Plugin Development Package.
Why? That 14Megs download contains 45Megs javadocs, which are mostly empty. I don’t have any document describing which way to go. And those 6 examples are little toys. While the Eclipse API is really huge, I was able to find valid javadoc comments, lots of examples and even some good books (not to mention the fact that developing with Eclipse means learning SWT/JFace). I also know about the support site, but I usually go to this kind of places to ask important/specific questions, and not <<Please help…>> ones.
I keep my interest open to support TestNG in Idea, but for the moment this seems to me quite impossible.

Disclaimer: this post is by no means meant to upset IntelliJ IDEA‘s developers. It is only my short experience while trying to develop a plugin.

2 Comments

Filed under Uncategorized