Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
<!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:roman; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face 	{font-family:Cambria; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:roman; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073741899 0 0 159 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-fareast-font-family:Calibri; 	mso-bidi-font-family:"Times New Roman";} h1 	{mso-style-priority:9; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-link:"Heading 1 Char"; 	mso-style-next:Normal; 	margin-top:24.0pt; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:0in; 	margin-bottom:.0001pt; 	line-height:115%; 	mso-pagination:widow-orphan lines-together; 	page-break-after:avoid; 	mso-outline-level:1; 	font-size:14.0pt; 	font-family:"Cambria","serif"; 	mso-fareast-font-family:"Times New Roman"; 	color:#365F91; 	mso-font-kerning:0pt;} h2 	{mso-style-priority:9; 	mso-style-qformat:yes; 	mso-style-link:"Heading 2 Char"; 	mso-style-next:Normal; 	margin-top:10.0pt; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:0in; 	margin-bottom:.0001pt; 	line-height:115%; 	mso-pagination:widow-orphan lines-together; 	page-break-after:avoid; 	mso-outline-level:2; 	font-size:13.0pt; 	font-family:"Cambria","serif"; 	mso-fareast-font-family:"Times New Roman"; 	color:#4F81BD;} a:link, span.MsoHyperlink 	{mso-style-priority:99; 	color:blue; 	text-decoration:underline; 	text-underline:single;} a:visited, span.MsoHyperlinkFollowed 	{mso-style-noshow:yes; 	mso-style-priority:99; 	color:purple; 	mso-themecolor:followedhyperlink; 	text-decoration:underline; 	text-underline:single;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:.5in; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-fareast-font-family:Calibri; 	mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:.5in; 	margin-bottom:.0001pt; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-fareast-font-family:Calibri; 	mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:0in; 	margin-left:.5in; 	margin-bottom:.0001pt; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-fareast-font-family:Calibri; 	mso-bidi-font-family:"Times New Roman";} p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast 	{mso-style-priority:34; 	mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-type:export-only; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:.5in; 	mso-add-space:auto; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-fareast-font-family:Calibri; 	mso-bidi-font-family:"Times New Roman";} span.Heading1Char 	{mso-style-name:"Heading 1 Char"; 	mso-style-priority:9; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Heading 1"; 	mso-ansi-font-size:14.0pt; 	mso-bidi-font-size:14.0pt; 	font-family:"Cambria","serif"; 	mso-ascii-font-family:Cambria; 	mso-fareast-font-family:"Times New Roman"; 	mso-hansi-font-family:Cambria; 	color:#365F91; 	font-weight:bold;} span.Heading2Char 	{mso-style-name:"Heading 2 Char"; 	mso-style-priority:9; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Heading 2"; 	mso-ansi-font-size:13.0pt; 	mso-bidi-font-size:13.0pt; 	font-family:"Cambria","serif"; 	mso-ascii-font-family:Cambria; 	mso-fareast-font-family:"Times New Roman"; 	mso-hansi-font-family:Cambria; 	color:#4F81BD; 	font-weight:bold;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt; 	mso-ascii-font-family:Calibri; 	mso-fareast-font-family:Calibri; 	mso-hansi-font-family:Calibri;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:336348364; 	mso-list-type:hybrid; 	mso-list-template-ids:-468954674 -1795027402 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l0:level2 	{mso-level-number-format:alpha-lower; 	mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l1 	{mso-list-id:457997104; 	mso-list-type:hybrid; 	mso-list-template-ids:551296060 1707082334 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l1:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l2 	{mso-list-id:520440586; 	mso-list-type:hybrid; 	mso-list-template-ids:-468954674 -1795027402 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l2:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l2:level2 	{mso-level-number-format:alpha-lower; 	mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l3 	{mso-list-id:937714289; 	mso-list-type:hybrid; 	mso-list-template-ids:-1384763946 -1795027402 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l3:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l4 	{mso-list-id:1247835953; 	mso-list-type:hybrid; 	mso-list-template-ids:-1296279488 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l4:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l5 	{mso-list-id:1576162199; 	mso-list-type:hybrid; 	mso-list-template-ids:340971974 -1795027402 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l5:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} @list l6 	{mso-list-id:1859349990; 	mso-list-type:hybrid; 	mso-list-template-ids:-1664833780 -1795027402 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l6:level1 	{mso-level-tab-stop:none; 	mso-level-number-position:left; 	text-indent:-.25in;} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} -->
h1. Windows Guide to Installing Wicket on Eclipse with Maven


h2. Download & Install Maven

Maven is a project management tool. It does a million things, but I only know three of those things. We'll use Maven to get the Wicket Quickstart, convert it to an Eclipse project, and package our WARs. But first we need to get Maven.

1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Go to [http://maven.apache.org/download.html].

2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Click the "apache-maven-2.0.10-bin.zip" link.

# Click the link at the top      of the page.
# That will prompt you to      download a file called _apache-maven-2.0.10-bin.zip_ . Save it to your desktop.
# Inside the zip file is a      folder called _apache-maven-2.0.10_.      Drag that folder and put it directly onto your C: drive-\-_{-_}C:\apache-maven-2.0.10\_ . \_\*IMPORTANT\*-{_}_\--Maven has problems if its      path has any spaces in it. For example, don't put Maven under your      "Program Files" folder, since there's a space in "Program Files"._
# Add an environment      variable called MAVEN_HOME with a value of _C:\apache-maven-2.0.10_ . You can learn how to set environment      variables here: [http://www.chem.gla.ac.uk/~louis/software/faq/q1.html#winXP]
# Add Maven's "bin"      directory to your PATH environment variable. In this case, you can just      paste
_; C:\apache-maven-2.0.10\bin_
to the end of your PATH. Don't forget to put the semicolon in front,      to separate it from anything that's already in your PATH.
# If you don't have a      JAVA_HOME environment variable, then create one of those too, pointing at      a JDK installation on your computer.
# Now you have Maven ready      to go. You can check that it's been installed correctly by opening a      command prompt (Start \-> Run... \-> cmd) and typing in "mvn      \-version". That should display a couple lines of information about      your Maven installation. &nbsp;
h2. Download Eclipse

Eclipse is a great IDE for developing Java applications.
# Go to [http://www.eclipse.org/downloads/] .
# Click the _Eclipse IDE for Java Developers_ link.
# Click the big green      download arrow.
# That will prompt you to      download a file called _eclipse-jee-ganymede-SR2-win32.zip_.      Save it to your desktop.
# Inside the zip file is a      folder called _eclipse_. Drag that      folder and put it directly onto your C: drive---_C:\eclipse\_ .
# That's it. Now you can run      Eclipse by going into the _eclipse_ folder and running eclipse.exe.

h2. Download WTP (optional)

WTP is an Eclipse plugin that provides nice web editing tools, including a good HTML editor. It's not necessary, it's nice to have. If you don't want WTP, skip this part. You can always come back and do it later.
# Go to [http://download.eclipse.org/webtools/downloads/] .
# Click the _3.0.4_ link:
# Then click the _wtp_ link under *Web App Developers*:
# The click the big green      arrow:
# That will prompt you to      download a file called _wtp-R-3.0.4-20090213193639.zip_.      Save it to your desktop.
# Inside the zip file is a      folder called _eclipse_. Drag that      folder and put it directly onto your C: drive. A popup window will tell      you that there's already a folder called _eclipse_ there, and ask if you want to continue. Say yes. That      will copy the contents of this _eclipse_ folder into the _eclipse_ folder      that's already on your C: drive.
# That's it. Now you will      have access to the WTP tools when using Eclipse. &nbsp;
h2. Install M2Eclipse

M2Eclipse is an Eclipse plugin that allows you to run your Maven project from within Eclipse.
# Open Eclipse.
# Go to the _Help_ menu and select _Software Updates..._
# A pop-up window will open.      Make sure the _Available Software_ tab is selected at the top of the pop-up window.
# Click the "Add Site..."      button on the right. That will pop up another window.
# Paste _[http://m2eclipse.sonatype.org/update/_] into the Location bar.      Then click OK.
# This will add a line to      the Available Software list titled _Maven      Integration for Eclipse Update Site_
# Check the checkbox next to _Maven Integration for Eclipse Update      Site_ and click "Install...".
# A window will pop-up      saying that the items you selected may not be valid yadda yadda yadda.      Click "Yes".
# Uncheck the boxes next to _Maven Integration for AJDT_ and _Maven SCM handler for Subclipse_.
# Click "Finish". That's it.      Now you've got everything ready to build your first Wicket application.

h2. Build Wicket Quickstart

We're almost there. Everything you've done so far will never need to be done again. This section contains all the directions to start a new project. Whenever you want to start a new project, you can come back to these steps.

The Wicket Quickstart contains all of the files and libraries necessary to make a Wicket project. It lives in the Maven repository, so we'll use Maven to download it and build it, and then we'll import it into Eclipse for you to play with.
# Create a folder called on _wicket_ on your C: drive to contain      your Wicket projects---_C:\wicket\_.
# Now open a browser and go      to [http://wicket.apache.org/quickstart.html] .
\\
 \# Under the "Creating the      project" section of the page, enter a GroupId and an ArtifactId. The      GroupId can be any string that reasonably identifies your organization.      The ArtifactId will be the name of your project. Leave Version at 1.3.5.      (You're welcome to try 1.4, but I haven't had much luck with that.)
# Now open a command prompt      (Start \-> Run... \-> cmd) and navigate to \_C:\wicket\_.
# Copy the text inside the      "Command Line" textbox from step 3 above and paste it into your command      prompt. Hit enter. Then wait as Maven downloads a bunch of stuff.
# When that finishes, you      will see that a new folder called _firstWicketProject_ has been created in your _C:\wicket\_ folder. From your command prompt, navigate into \_firstWicketProject_.
# Your command prompt should      now be in _C:\wicket\firstWicketProject_.      From here, type
_mvn eclipse:eclipse_
and hit Enter. Wait while Maven download more stuff.
# Now open Eclipse, if you      don't already have it open. Go to the _File_ menue and select _Import..._ A      window will pop up with several folders.
# Expand the top folder,      named "General". Select the "Existing Projects into Workspace" option and      click "Next".
# Click the "Browse..." button      to the right of the "Select root directory" prompt.
# Navigate to _C:\wicket\firstWicketProject_ and      click "OK".
# The Projects area of the      window will now show "firstWicketProject" with a checkbox checked next to      it. Click Finish. &nbsp;
h2. Running the Application

Congratulations\! You've installed the necessary software and built your first Wicket project. Now lets look at the project files and get it running.
# In the Package Explorer on      the left hand side of the screen, you'll now see a folder called      "firstWicketProject". If you expand that folder you'll lots of stuff. The      important items are _src/main/java_, _src/test/java_, and _src_.
# _src/main/java_ contains the project Java and HTML files. This      is where you'll add new pages.
# _src/test/java_ contains the embedded server. We'll come back      here in a minute.
# _src_ contains your web.xml file. You'll find it under _src/main/webapp/WEB-INF_. Use that      to set up your project configuration.
# Now go back to _src/test/java_. Inside you'll see a      package that has the same name as the GroupId you entered on the      Quickstart website.
# Expand the package inside _src/test/java_ and you'll see a Java      file called Start.java. Right-click Start.java and go down to "Debug as..."      and select "Java Application". You'll see the server starting up inside      the console at the bottom of the screen.
# To test to see if      everything is working, open a browser and go to [http://localhost:8080] . You should see a      message telling you and Wicket is running.
# To stop the server, click      the red square at the top right of the console in Eclipse. You may need to      stop and start the server after you make programming changes in order for      the changes to take effect. &nbsp;
h2. Bonus Section

That's just about everything. Now you're ready to go into your _src/main/java_ and start building your application. However, there's one more change I suggest you make.
# Go back to _src/test/java_ and open the      Start.java file into the Eclipse editor.
# Delete the entire contents      of the file and paste in the following instead. I find this change helps      the embedded server to pick up your code changes without needing to be      restarted.
\\
{{
| | package     edu.chemeketa;\\
 \\
import     java.lang.management.ManagementFactory;\\
 \\
import     javax.management.MBeanServer;\\
 \\
import     org.mortbay.jetty.Server;\\
import  import   org.mortbay.jetty.nio.SelectChannelConnector;\\
import     org.mortbay.jetty.webapp.WebAppContext;\\
import     org.mortbay.management.MBeanContainer;\\
 \\
/*\*\\
&nbsp;\
 * Seperate startup class for people that     want to run the examples\\
&nbsp;\
 * directly.\\
&nbsp;\
 */\\
public class     Start {\\

 \\
&nbsp; /*\*\\
&nbsp;&nbsp; \
   * Main function, starts the jetty     server.\\
&nbsp;&nbsp; \
   * \\
&nbsp;&nbsp; \
   * @param args\\
&nbsp;&nbsp; \
   */\\
&nbsp;  public static void main(String\[\] args)     throws Exception {\\

 \\
&nbsp;&nbsp;&nbsp;    Server server = new Server();\\
&nbsp;&nbsp;&nbsp; SelectChannelConnector connector = new SelectChannelConnector connector = new SelectChannelConnector();\\
&nbsp;&nbsp;&nbsp;
    connector.setPort(8080);\\
&nbsp;&nbsp;&nbsp;
    server.addConnector(connector);\\

 \\
&nbsp;&nbsp;&nbsp;   WebAppContext web = new     WebAppContext();\\
&nbsp;&nbsp;&nbsp;
    web.setContextPath("/");\\
&nbsp;&nbsp;&nbsp;);
    web.setWar("src/main/webapp");\\
&nbsp;&nbsp;&nbsp;
    server.addHandler(web);\\

 \\
&nbsp;&nbsp;&nbsp;    MBeanServer mBeanServer = ManagementFactory\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        .getPlatformMBeanServer();\\
&nbsp;&nbsp;&nbsp; );
    MBeanContainer mBeanContainer = new     MBeanContainer(mBeanServer);\\
&nbsp;&nbsp;&nbsp;
    server.getContainer().addEventListener(mBeanContainer);\\
&nbsp;&nbsp;&nbsp;
    mBeanContainer.start();\\

 \\
&nbsp;&nbsp;&nbsp;    try {\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      System.out.println(">>>     STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP");\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      server.start();\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      while (System.in.available() == 0) {\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        Thread.sleep(5000);\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      }
      server.stop();\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      server.join();\\
&nbsp;&nbsp;&nbsp;
    } catch (Exception e) {\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      e.printStackTrace();\\
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      System.exit(100);\\
&nbsp;&nbsp;&nbsp; }\\
&nbsp; }\\
}\\ | | 
    }
  }
}
}}