...
Windows
...
Guide
...
to
...
Installing
...
Wicket
...
on
...
Eclipse
...
with
...
Maven
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. Go to http://maven.apache.org/download.html
...
.
...
2. 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:
...
...
- 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.
...
-
Download Eclipse
Eclipse is a great IDE for developing Java applications.
...
- .
...
- 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.
...
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
...
...
- .
...
- 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.
...
-
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.
...
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
...
...
- .
# 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.
...
-
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
...
...
- .
...
- 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.
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.
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); } } } }} |