tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Tapestry > Loading the Project Into Eclipse
Date Tue, 07 Dec 2010 02:23:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/12/_/styles/combined.css?spaceKey=TAPESTRY&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/TAPESTRY/Loading+the+Project+Into+Eclipse">Loading
the Project Into Eclipse</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~hlship">Howard
M. Lewis Ship</a>
    </h4>
        <br/>
                         <h4>Changes (3)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{noformat} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">At
this point, Maven has created the Eclipse {{.project}} and {{.classpath}} files, and we can
import the project. In addition, since we specified {{-DdownloadSources}}, it has downloaded
the sources to Tapestry and its dependencies and linked the library JAR files to those source
JARs; that means we can see the sources for any Tapestry classes right into Eclipse, which
is very useful when debugging or exploring. <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">At
this point, Maven has created the Eclipse {{.project}} and {{.classpath}} files, and we can
import the project. In addition, since we specified {{-DdownloadSources=true}}, Maven has
also downloaded the sources of each library and linked to the source JAR; that means we can
see the sources for any Tapestry classes right inside Eclipse, which is very useful when debugging
or exploring. <br></td></tr>
            <tr><td class="diff-unchanged" > <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-added-words"style="background-color:
#dfd;">At this point, we are ready to import the project created by Maven into Eclipse
so we can start working with it.</span> Launch Eclipse and switch over to the Java Perspective.
<br></td></tr>
            <tr><td class="diff-unchanged" > <br>Right click inside the
Package Explorer view and select *Import ...* <br> <br></td></tr>
            <tr><td class="diff-unchanged" >!eclipse-java-persp.png|thumbnail!
<br> <br></td></tr>
            <tr><td class="diff-unchanged" >Choose the &quot;existing projects&quot;
option: <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >When you click the Finish button,
the project will be imported into the Eclipse workspace. <br> <br></td></tr>
            <tr><td class="diff-unchanged" >!eclipse-project-errors.png|thumbnail!
<br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/TAPESTRY/Creating+The+Skeleton+Application"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/TAPESTRY/Creating+The+Skeleton+Application">Creating
The Skeleton Application</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/TAPESTRY/Tapestry+Tutorial"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/TAPESTRY/Tapestry+Tutorial">Tapestry Tutorial</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/TAPESTRY/Exploring+the+Project">Exploring
the Project</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/TAPESTRY/Exploring+the+Project"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>

<p>The first step is to ask Maven to generate the Eclipse control files (<tt>.classpath</tt>
and <tt>.project</tt>) for us:</p>

<div class="preformatted panel" style="border-width: 1px;"><div class="preformattedContent
panelContent">
<pre>$ mvn eclipse:eclipse -DdownloadSources=true
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'eclipse'.
[INFO] org.apache.maven.plugins: checking for updates from apache-snapshots
[INFO] org.codehaus.mojo: checking for updates from apache-snapshots
[INFO] artifact org.apache.maven.plugins:maven-eclipse-plugin: checking for updates from apache-snapshots
[INFO] snapshot org.apache.maven.plugins:maven-eclipse-plugin:2.9-SNAPSHOT: checking for updates
from apache-snapshots
Downloading: http://repository.apache.org/snapshots//org/apache/maven/plugins/maven-eclipse-plugin/2.9-SNAPSHOT/maven-eclipse-plugin-2.9-20101117.070458-148.pom
11K downloaded  (maven-eclipse-plugin-2.9-20101117.070458-148.pom)
Downloading: http://repository.apache.org/snapshots//org/apache/maven/plugins/maven-eclipse-plugin/2.9-SNAPSHOT/maven-eclipse-plugin-2.9-20101117.070458-148.jar
194K downloaded  (maven-eclipse-plugin-2.9-20101117.070458-148.jar)
[INFO] ------------------------------------------------------------------------
[INFO] Building tutorial1 Tapestry 5 Application
[INFO]    task-segment: [eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
[INFO] No goals needed for project - skipping
[INFO] [eclipse:eclipse {execution: default-cli}]
[INFO] Using Eclipse Workspace: /Users/Howard/Documents/workspace
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER
[INFO] Wrote settings to /Users/Howard/Documents/workspace/tutorial1/.settings/org.eclipse.jdt.core.prefs
[INFO] Wrote Eclipse project for "tutorial1" to /Users/Howard/Documents/workspace/tutorial1.
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Wed Nov 17 17:13:11 PST 2010
[INFO] Final Memory: 21M/81M
[INFO] ------------------------------------------------------------------------
~/Documents/workspace/tutorial1
$ 
</pre>
</div></div>

<p>At this point, Maven has created the Eclipse <tt>.project</tt> and <tt>.classpath</tt>
files, and we can import the project. In addition, since we specified <tt>-DdownloadSources=true</tt>,
Maven has also downloaded the sources of each library and linked to the source JAR; that means
we can see the sources for any Tapestry classes right inside Eclipse, which is very useful
when debugging or exploring.</p>

<p>At this point, we are ready to import the project created by Maven into Eclipse so
we can start working with it. Launch Eclipse and switch over to the Java Perspective.</p>

<p>Right click inside the Package Explorer view and select <b>Import ...</b></p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 1024x746"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-java-persp.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-java-persp.png" style="border: 0px solid
black" /></a></span></p>

<p>Choose the "existing projects" option:</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 525x550"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-import.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-import.png" style="border: 0px solid
black" /></a></span></p>

<p>Now select the folder created by Maven:</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 525x601"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-import-folder.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-import-folder.png" style="border: 0px
solid black" /></a></span></p>

<p>When you click the Finish button, the project will be imported into the Eclipse workspace.</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 1024x746"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-project-errors.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-project-errors.png" style="border: 0px
solid black" /></a></span></p>

<p>However; there are many errors.  Maven expects that you will configure a classpath
variable, <tt>M2_REPO</tt>, that points at your local repository; a directory
in your home directory that stores all those downloaded JARs and other files.  Open Eclipse's
preferences panel and navigate to <b>Java &gt; Build Path &gt; Classpath Variables</b>:</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 624x537"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-classpath-vars.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-classpath-vars.png" style="border: 0px
solid black" /></a></span></p>

<p>Click the <b>New</b> button, and enter the new variable (you'll have
to adjust this for your operating system and local paths):</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 576x174"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-new-var.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-new-var.png" style="border: 0px solid
black" /></a></span></p>

<p>Eclipse will ask to perform a clean build, and the errors will be gone once it has
done so.</p>


<h1><a name="LoadingtheProjectIntoEclipse-RunningtheApplicationinsideEclipse"></a>Running
the Application inside Eclipse</h1>

<p>The task is to set up Jetty to run our application directly out of our Eclipse workspace.
This is a great way to develop web applications, since we don't want to have to use Maven
to compile and run the application ... or worse yet, use Maven to package and deploy the application.
That's for later, when we want to put the application into production. For development, we
want a fast, agile environment that can keep up with our changes, and that means we can't
wait for redeploys and restarts.</p>

<p>Choose the <b>Run ...</b> item from the Eclipse <b>Run</b>
menu to get the launch configuration dialog:</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 800x640"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-run.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-run.png" style="border: 0px solid black"
/></a></span></p>

<p>Select <b>Jetty Webapp</b> and click the <b>New</b> button,
then fill in a few values:</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 963x746"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-launch.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-launch.png" style="border: 0px solid
black" /></a></span></p>

<p>Make sure you clear the field labeled <b>HTTPS</b>.</p>

<p>You can then click <b>Run</b> and Jetty will launch (it takes only a
few seconds):</p>

<p>Once you click Run, Jetty will start up and launch (it should take about two seconds).</p>

<p><span class="image-wrap" style=""><a class="confluence-thumbnail-link 727x331"
href='https://cwiki.apache.org/confluence/download/attachments/24188253/eclipse-jetty.png'><img
src="/confluence/download/thumbnails/24188253/eclipse-jetty.png" style="border: 0px solid
black" /></a></span></p>

<p>You may now start the application with the URL <a href="http://localhost:8080/tutorial1/"
class="external-link" rel="nofollow">http://localhost:8080/tutorial1/</a></p>
<style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/TAPESTRY/Creating+The+Skeleton+Application"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/TAPESTRY/Creating+The+Skeleton+Application">Creating
The Skeleton Application</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/TAPESTRY/Tapestry+Tutorial"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/TAPESTRY/Tapestry+Tutorial">Tapestry Tutorial</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/TAPESTRY/Exploring+the+Project">Exploring
the Project</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/TAPESTRY/Exploring+the+Project"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/TAPESTRY/Loading+the+Project+Into+Eclipse">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=24188253&revisedVersion=6&originalVersion=5">View
Changes</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message