cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@cocoon.apache.org
Subject [Cocoon Wiki] Updated: LoadInEclipse
Date Tue, 28 Dec 2004 13:32:51 GMT
   Date: 2004-12-28T05:32:51
   Editor: TorstenSchlabach
   Wiki: Cocoon Wiki
   Page: LoadInEclipse
   URL: http://wiki.apache.org/cocoon/LoadInEclipse

   no comment

Change Log:

------------------------------------------------------------------------------
@@ -49,9 +49,39 @@
 
 ----
 
+=== Eclipse, its workspace and projects ===
+
+As silly as it sounds, but picking up an already existing project in Eclipse is not alway
straigt forward, mostly because Eclipse offers a lot of options. Most of them are misleading
for what we want to achieve here. But they are sitting on the menus ready to lead you in the
wrong direction. As this is not really a in-depth Eclipse internals tutorial, let's keep a
long story short.
+
+Eclipse keeps a .metadata directory in each workspace. In there it records the projects it
knows about in the workspace. Therefore just extracting the Cocoon tarball into the Eclipse
workspace will not make the project show up at all.
+
+The next logical step then would be to use the File -> Import option and select "Existing
Project into Workspace". This might work somehow, but it leaves the project where it is. In
other words, this is '''not''' a means to copy the extracted Cocoon source tree from a temporary
location where you unpacked it into your workspace. It rather is a means of '''referencing'''
a project outside the workspace. If you rely on keeping things together in your workspace(s)
this is not what you want, either.
+
+The Cocoon build.xml file provides a target to create an Eclipse project (which means it
will create the .project and .classpath files that Eclipse expects) but Eclipse does not know
how about this target and will not call it no matter what import mechanism you use.
+
+So the best way to make the Cocoon source tree available in Eclise is:
+
+ * Extract the Cocoon tarball into the Eclipse workspace directory. This should create a
folder $ECLIPSE_WORKSPACE/cocoon-x.y.z with the well known Cocoon source tree structure in
it.
+ * From the command line of your os change the directory to $ECLIPSE_WORKSPACE/cocoon-x.y.z,
set the JAVA_HOME environment variable if needed and run the command {{build eclipse-project}}
(Windows) or {{./build.sh eclipse-project}} (*ix). Now you have two new files: .project and
.classpath. Nothing else so far.
+ * In Eclipse, choose File -> New -> Project and select "Java Project". (This is not
very logical as we already have an Eclipse Java project, don't we?)
+ * On the dialogue that comes up, make sure the option "Create Project in Workspace" is selected
and enter the project name '''exactly''' as the name of the directory, for example {{cocoon-2.1.6}}.
+
+Once you do that, note the information that shows up in the bottom of the dialogue. (It will
only show up if you name the project identical to the folder!) Hit finish and you are done.
Cocoon is now a project in your Eclipse Workbench using the correct settings from the .classpath
and .project files.
+
+''Note'': Eclipse considers it a feature that the project's name in the workspace can be
different from the name on the file system. You can then refer to the project name instead
of the filesystem name, for example when building project dependencies. But in Cocoon land
this is causing more trouble than doing any good, therefore it is recommended to keep the
project's name in the workspace and the directory name on the filesystem in sync.
+
+At this point, depending on your hardware, you might notice a lot of activity going on. This
is because of Eclipse's habit to compile a .java file as soon as it sees one. This is the
default setting for a new project and we did not yet have a chance to chance this. So either
wait for it to finish (and ignore and warnings or errors) or interrupt the build process and
then:
+
+ * make sure the Option ''Build Automatically'' from the ''Project'' menu is not marked.
+ * Chosse Project -> Clean (make sure you clean only your project and you do not run a
build straight afterwards) to get rid of the classes that Eclipse just built.
+
+''Note'': Wouldn't it be possible to set these settings in the .project file so the build
does not even start at all?
+
+Now you are finally ready to turn to the section about actually building Cocoon in Eclise!
+
 === Building Cocoon using Eclipse internal Ant ===
 
-{{{ broken at least for 2.1.5 and above, see above }}}
+{{{ broken at least for Cocoon versions => 2.1.5, see section above }}}
 
 Here are the required steps:
  *  run {{{build eclipse-project}}}: this creates the {{{.project}}} and {{{.classpath}}}
files,
@@ -84,6 +114,12 @@
 
 ----
 
+I don't know where I should put that.
+
+TorstenSchlabach
+
+----
+
 I discovered one problem with IBM's WSAD under Linux. In the .project file the <name>project-name</name>
should be the same as the path.
 For instance:
  *  <name>cocoon-2.1m3</name>
@@ -92,6 +128,27 @@
 GerhardFroehlich
 
 ----
+
+=== Building Cocoon in Eclipse using Cocoon's packaged Ant ===
+
+''Note'': This is kind of a workaround and it has not yet been fully researched what implications
this approach has on the Eclipse way of doing things (especially on-the-fly compiling, automatic
reloading of web applications what using a Tomcat plugin and the like). In fact what is described
here is little more than a more convenient way of just browsing and editing the Cocoon source
tree in Eclipse but keeping a command line window open to trigger the build from there. One
important feature of this "external tools" approach is that Eclipse will do a refresh of the
project after a build - if you don't forget to configure it!
+
+We assume $ECLIPSE_WORKSPACE is your Eclipse workspace here.
+
+Here are the required steps:
+ * 
+ *  run {{{build eclipse-project}}}: this creates the {{{.project}}} and {{{.classpath}}}
files,
+ *  launch Eclipse,
+ *  open the "CVS repository exploring" perspective. This forces the loading of Eclipse's
CVS plugin that will prevent the IDE being confused by CVS files present in your filesystem,
+ *  create a new Java project in Eclipse,
+ *  give it any name you want ("Cocoon" is a good choice !)
+ *  uncheck "use default" and browse to the location of your Cocoon checkout
+ *  click "Finish", wait a little bit and enjoy!
+
+For using CVS functionality provided by Eclipse you must do additional steps:
+ *  right click on the project icon, choose "Team" and "Share Project"
+ *  You might get a message about the currently-existing CVS directories, which is good.
Click through and Eclipse will think a little more.
+ *  To perform CVS operations on files, right click on the file in Eclipse, and choose "Team".
You should see Commit, Update, etc.
 
 === Running Cocoon Jetty from within Eclipse ===
 

Mime
View raw message