| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <title> |
| Products sharing a common source framework |
| </title> |
| <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script> |
| </head> |
| <body> |
| <h1> |
| Products sharing a common source framework |
| </h1> |
| <h3>Layout on file system</h3> |
| <ul> |
| <li>The Java source files for two products require a common framework.</li> |
| <li>Projects and common framework are in separate directories which have their own source and output folders.</li> |
| <p><img src="../images/qs-WorkingWithExistingLayout40.png" alt="Layout 40"></p> |
| </ul> |
| <h3>Steps for defining corresponding projects</h3> |
| <ol> |
| <li> |
| <p>Click |
| <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.jdt.ui.JavaPerspective)")'> |
| <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"> |
| <strong>Window > Open Perspective > Other... > Java</strong></a> |
| to change to the Java perspective. |
| </p> |
| </li> |
| <li> |
| <p> |
| Click |
| <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.newWizard(newWizardId=org.eclipse.jdt.ui.wizards.JavaProjectWizard)")'> |
| <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"> |
| <strong>File > New > Other... > Java Project</strong></a> |
| to open the <strong>New Java Project</strong> wizard. |
| </p> |
| </li> |
| <li> |
| <p>Type "Product1" in the <strong>Project name</strong> field. Click <strong>Next</strong>.</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout41.png" alt="Layout 41"></p> |
| </li> |
| <li> |
| <p>On the next page, Select "Product1" source folder.</p> |
| <p>Click <strong>Link Additional Source to Project</strong> button <img src="../images/add_linked_source_to_buildpath.png" alt="Link Additional Source to Project"> in view bar.</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout42.png" alt="Layout 42"></p> |
| </li> |
| <li> |
| <p>In <strong>Link Additional Source</strong> click <strong>Browse....</strong> and choose the <i><code>D:\Product1\JavaSourceFiles</code></i> directory.</p> |
| <p>Type "src" in the <strong>Folder name</strong> field.</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout31.png" alt="Layout 31"></p> |
| </li> |
| <li> |
| <p>Click <strong>OK</strong> to close the dialog.</p> |
| </li> |
| <li> |
| <p>Click <strong>OK</strong> in confirmation dialog to have "Product1/bin" as default output folder.</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout12.png" alt="Layout 12"></p> |
| </li> |
| <li> |
| <p>Your project source setup now looks as follows:</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout43.png" alt="Layout 43"></p> |
| </li> |
| <li> |
| Click <strong>Finish</strong>. |
| </li> |
| <li> |
| <p>Edit project "Product1"properties and select <strong>Java Builder Path</strong> page.</p> |
| <p>On <strong>Source</strong> tab, click <strong>Add Folder...</strong>.</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout33.png" alt="Layout 33"></p> |
| </li> |
| <li> |
| <p>On <strong>Source Folder Selection</strong> click <strong>Create New Folder...</strong>.</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout44.png" alt="Layout 44"></p> |
| </li> |
| <li> |
| <p>In <strong>New Folder</strong>, type "src-common" in the <strong>Folder name</strong> field.</p> |
| <p>Click <strong>Advanced>></strong> and check <strong>Link to folder in the file system</strong>.</p> |
| <p>Then click <strong>Browse....</strong> and choose the <i><code>D:\Framework\JavaSourceFiles</code></i> directory.</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout45.png" alt="Layout 45"></p> |
| </li> |
| <li> |
| <p>Click <strong>OK</strong> twice to close dialogs.</p> |
| </li> |
| <li> |
| <p>Your project setup now looks as follows:</p> |
| <p><img src="../images/qs-WorkingWithExistingLayout46.png" alt="Layout 46"></p> |
| </li> |
| <li> |
| Click <strong>OK</strong>. |
| </li> |
| <li> |
| <p>Repeat these steps for "Product2".</p> |
| </li> |
| <li> |
| You now have two Java projects which respectively contain the sources of "Product1" and "Product2" |
| and which are using the sources of "Framework". |
| <p><img src="../images/qs-WorkingWithExistingLayout47.png" alt="Layout 47"></p> |
| </li> |
| </ol> |
| <em>Note: </em>Files in "src-common" are shared. So editing "Common.java" in "Product1" |
| will modify "Common.java" in "Product2". However they are compiled in the context of their |
| respective projects. Two "Common.class" files will be generated; one for each project. If the two projects have |
| different compiler options, then different errors could be reported on each "Common.java" file. |
| |
| <p> |
| <img border="0" src="../images/ngrelc.png" alt="Related concepts" > |
| </p> |
| <p> |
| <a href="../concepts/concepts-3.htm">Java projects</a><br> |
| <a href="../concepts/concepts-6.htm">Java views</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelt.png" alt="Related tasks" border="0" > |
| </p> |
| <p> |
| <a href="../tasks/tasks-110.htm">Working with build paths</a><br> |
| <a href="../tasks/tasks-12.htm">Creating a new Java project</a><br> |
| <a href="../tasks/tasks-14.htm">Creating a Java project with source folders</a><br> |
| <a href="../tasks/tasks-26.htm">Creating a new source folder</a><br> |
| <a href="../tasks/tasks-45.htm">Using the Package Explorer</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelr.png" alt="Related reference"> |
| </p> |
| <p> |
| <a href="../reference/ref-121.htm">New Java Project Wizard</a><br> |
| <a href="../reference/ref-view-package-explorer.htm">Package Explorer View</a><br> |
| </p> |
| |
| </body> |
| </html> |
| |