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.
2 comments:
Path Variables, under Settings, do just what you're asking.
Thanks. But that doesn't seem to be what I am looking: those variables are pointing to jar/groups of jars. I was trying to create a variable that can be extended.
Here it is the difference: with Idea it looks like the classpath will be: $YOUR_VARIABLE$, while I would like to have: $YOUR_VARIABLE$/somejar1.jar;$YOUR_VARIABLE$/somejar2, etc.
I hope everybody can see the difference, and why I consider the 2nd approach more generic and better fit when talking about sharing project/module definitions.
Post a Comment