If you haven't yet read the online manual, do yourself the favor and read it
over; it provides most to all answers to your questions, and other features
you will want to know about.

The following should help kick-start you:

- Use relative directories (from the prj.el file).  It is the same principle
as relative dirs with Ant.  If all of your projects are that similar in
structure, you will have an unchanging one. (answers question 1)

- I suggest moving your prj.el file into the same dir as your build.xml.
This makes relative dirs scope the same as Ant (which is large). (answers
question 3)

- Use environment variables when useful to set a base dir.  This mainly
helps the portability of the prj.el file for different PCs/users.

- For the classpath setting, JDE will automatically add all jars in a
specified directory. (answers question 2)

- I have in .emacs some of the settings you have, since they are the
settings I want on all projects.


Here is the standard prj.el file I have been using for a long time for JDE
projects to give you examples of the above suggestions.

(jde-project-file-version "1.0")
(jde-set-variables
 '(jde-javadoc-gen-destination-directory "./build/javadoc")
 '(jde-global-classpath (quote ("." "$JAVA_HOME/jre/lib/rt.jar"
"$J2EE_HOME/lib/j2ee.jar" "./build/class" "./lib")))
 '(jde-compile-option-directory "./build/class")
 '(jde-sourcepath (quote ("$JAVA_SRC_HOME" "$J2EE_SRC_HOME" "./code/java")))
 '(jde-help-docsets (quote (("JDK API" "$JAVA_DOC_HOME/api" nil) ("JDK API"
"$J2EE_DOC_HOME/api" nil) ("User (javadoc)" "./build/javadoc" nil)))))


> -----Original Message-----
> From: Jesper Holmberg [mailto:[EMAIL PROTECTED]
> Sent: Saturday, March 27, 2004 2:40 PM
> To: [EMAIL PROTECTED]
> Subject: Best practices for setting up project file
>
>
> I feel that I am not using all the features of JDEE to the
> maximum. More
> specifically I seem to have problems setting up my
> environment so that 1)
> JDEE finds everything it needs to do it's magic stuff and 2)
> I don't have to
> write a lot of project details when I start a new project. I
> thus wonder if
> people could share some of their tips how they go about
> setting up a new
> project.
>
> Here is what I do so far:
>
> I always start a new project with this basic file structure:
>
> .
> |
>  - build.xml
>  - lib
>  - src
>      |
>       - project
>           |
>             - prj.el
>             - MainClass.java
>
>
> I use ant to bild my projects. Now, the prj.el typically contains the
> following:
>
> (jde-project-file-version "1.0")
> (jde-set-variables
>  '(jde-project-name "project")
>  '(jde-ant-enable-find t)
>  '(jde-global-classpath (quote
> ("~/src/fasade/project/lib/Library1.jar")
>
> ("~/src/fasade/project/lib/Library2.jar")))
>  '(jde-run-working-directory "~/src/fasade/project/")
>  '(jde-build-function (quote (jde-ant-build)))
>  '(jde-sourcepath (quote ("~/src/fasade/project/src/")))
>  '(jde-run-application-class "project.MainClass")
>  '(jde-ant-working-directory "~/src/fasade/project/"))
>
>
> My questions:
>
> 1. Is it possible to set some sort of variable so that I
> don't have to write
> "~/src/fasade/project" everywhere? I can't set this as an environment
> variable, since it is different for every project.
>
> 2. Ant picks up any jar file put in the lib directory and adds it to
> the classpath through lib/**/*.jar. Is there anything similar
> which can be
> set for JDEE so that I don't have to explicitly name every
> jar-file I wan't
> to include?
>
> 3. Is the placing of the prj.el down in the src-tree the
> correct one, or
> should I rather put it in the project root?
>
>
> TIA,
>
> Jesper
>

Reply via email to