Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.        Go to http://maven.apache.org/download.html.

2.        Click the "apache-maven-2.0.10-bin.zip" link.Image Added
 3. Click the link at the top of the page.
Image Added

4. That will prompt you to download a file called apache-maven-2.0.10-bin.zip . Save it to your desktop.

5. 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".

6. 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

7. 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.

8. If you don't have a JAVA_HOME environment variable, then create one of those too, pointing at a JDK installation on your computer.

9.  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.

...

Download Eclipse

Eclipse is a great IDE for developing Java applications.

1. Go to http://www.eclipse.org/downloads/ .

2. Click the Eclipse IDE for Java Developers link.
Image Added
3. Click the big green download arrow.Image Added
4. That will prompt you to download a file called eclipse-jee-ganymede-SR2-win32.zip. Save it to your desktop.

5. Inside the zip file is a folder called eclipse. Drag that folder and put it directly onto your C: drive---_C:\eclipse_ .

6. That's it. Now you can run Eclipse by going into the eclipse folder and running eclipse.exe.

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.

...

Code Block
package edu.chemeketa;

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;

import org.mortbay.jetty.Server;
import org.mortbay.jetty.nio.SelectChannelConnector;
import org.mortbay.jetty.webapp.WebAppContext;
import org.mortbay.management.MBeanContainer;

/**
 * Seperate startup class for people that want to run the examples
 * directly.
 */
public class Start {

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

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

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

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

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