You are on page 1of 16

How to survive the first encounter with tapestry. Installation process step by step.

(By: Djordje Popovic)

When i started with tapestry last year, i found some of the installations steps a bit
confusing so what i did, was writing all down, in case i had to repeat some of the steps.
I knew that this would be handy some when in the future and thats why i created this
little installation quick-start guide. I hope it helps you as it helped me, fell free to share it
with all your fellow colleges.

Table of Contents:
1. Installing the JDK.
2. The environment variables for the JDK.
3. Maven installation.
4. Creating your first project from the command line.
5. Eclipse install.
6. Eclipse needed plugins.
7. Importing a maven project into eclipse
8. Additional tools that may be very handy
9. Fixing a possible issue with the eclipse.ini file.

So as i said before lets start from the very beginning so there will be less chances to have
issues related with the installation later on.

STEP 1 Installing the JDK.


To work with tapestry, we need to have the JDK(Java Development Kit) installed in our
system. The reason why i did not use the latest version of the JDK at that time(1.6.16)
and instead i just used JDK 5 was because at that time i had a subject related to data bases
that had compatibility issues with JDKs higher than 6.It will also work with JDK 6 now,
fell free to follow this steps with the latest JDK.
Lets get started:
1. Go to http://java.sun.com/javase/downloads/index.jsp and find the JDK you want.

2. After the JDK is downloaded, perform the installation(I think there is no need to
explain the installation in depth)

STEP 2 The environment variables to the JDK.


Once the JDK is installed, we have to tell the computer, how to find it when a
program needs it. This is done by configuring the windows environment variamles.

1. Right click on my computer and then go to properties

2. Now position yourself in the advanced tab and click on Environment


variables.

3. Inside the environment variables menu select the Path variable and click on
Edit.

4. At the edit menu just add the path to the JDK bins folder (example: C
C:\Program Files\Java\jdk1.6.0_14\bin;) but be sure that it is separated with ;
and that there are no blank spaces(otherwise it will not work).

5. Once the variable is set the JDK its ready to work. You can check if you have
install it correctly by typing on the console java version.

STEP 3 Maven installation

Maven is the is a software project management and comprehension tool that will be used
in combination with our tapestry projects, so we need to install it too.(More information
about maven at: http://maven.apache.org/ ).

1. Download maven from the download section at:


http://maven.apache.org/download.html

2. Unzip maven into the C:/ partition root.


3. Set the environment variables for maven. So as we did with the JDK, lets right
click on my computer and in the advance tab hit Environment variables. This time
click on New to create a new Variable.

4. The first variable is the JAVA_HOME it should bring you to the root of the JDK,
but not inside the bin folder.(example: C C:\Program Files\Java\jdk1.6.0_14)

5. Click New again and create the second variable. It will be called M2_HOME it
should bring us inside the unzipped maven folder.

6. Now the last variable will be called M2 and it should bring you to the bin folder
inside the apache maven folder, but using the variable M2_HOME. (The reason of
this is unknown to me but it gave me problems when i did it in way different than
this one. Maybe it has to do something with the OS). The value should be
%M2_HOME%\bin
7. Once all the user variables are ok. You have to update the path variable. So go to
it and append the destination to the maven folder.(Example: C:\apache-maven-
2.2.1\bin Remember, it has to be separated with ; and not blanks are allowed)

8. Check if maven its installed ok, by typing in the windows console mvn version

STEP 5 Creating your first tapestry project.


Well at this point our system should be able to create a maven project(even if we dont
have an IDE). Lets try.
1. Connect yourself to the internet(if it is your first project you must)
2. Go to the console and position yourself in the folder you desire your project to be
created.
Type this:
mvn archetype:generate -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository
3. Follow the required fields correctly to create a new project(this is an example)

4. After all needed is downloaded(it may take a while) you should see this message:

5. Test the application in the jetty server by typing mvn jetty:run when you are
positioned inside the project.

6. If everything went ok you should see something like this

7. Now go to your browser and type http://localhost:8080 and you should now see
the application running.
The next step is related to the eclipse installation, but if you have eclipse installed
and just want to create a maven project, in an automated way using the wizard,
just follow the steps at: http://bbwebcraft.blogspot.com/2008/12/task-1-create-
skeleton-tapestry-5.html
This is how you see the project when the server is running:

More detailed info about this way of creating a project can be found at:
http://tapestryjava.blogspot.com/2009/01/using-maven-to-create-new-tapestry-
51.html
STEP 6 Eclipse installation

In order to program fastest and easier we will need an IDE (Integrated Development
Environment), so lets go get a really good one.

1. Navigate to http://www.eclipse.org/downloads/ and pick the eclipse IDE you


prefer. I will pick the EE edition of eclipse because it comes with a fancy
integrated web browser (You can pick the standard version if you want, it does
not have to be EE).

2. Unzip the eclipse folder in C:/ or C:/ProgramFiles.

3. Now that we have eclipse and we have maven, lets combine both to work in an
easier way. To do this we have to get an integration plugin that will allow us to
work with maven, when using eclipse. So lets navigate to
http://m2eclipse.sonatype.org/ and get the update link located in there.

4. Now go to eclipse Help>install new software.


5. Paste the link in the search field and click Add

6. When eclipse finishes retrieving the available sources, choose the ones we
need(see the pic) and hit next.
7. When you arrive to the license agreement page, accept and hit finish for the
installation to begin.

8. Now the installation process should start automatically(It will take a while)

9. When done, restart eclipse.


STEP 7 Importing a maven project
We are near fellow colleges, just a couple of steps more and we will be ready to start
programming in tapestry at full speed.

1. Lets import the program we created before from the console into eclipse, and
latter we will set the HTML and XML editor in the workbench. So go to
Fileimport

2. Select maven project and click on next.


3. Dont freak out all is under control! What you see in this picture is a little
issue that may appear sometimes, it is related with an .ini file (We will talk
about that later), just click Ok for now.

4. Find the project and click ok and then finish.


5. Now eclipse will update automatically if it is needed, and the project will be
shown in the package explorer.

6. We can start jetty server to test the application (this time from inside eclipse)
just right click the pom.xml and select run asmaven:build

7. In the new window just type jetty:run and the server will start and run the
application.
8. After eclipse downloads all needed stuff in the console you should see
something like this:

9. Thats it, it works! You can now type in your web browser
http://localhost:8080 to see the program working.
STEP 8 Additional tools that may be very handy

While web programming in tapestry we may encounter files with extensions such
as .tml .xml In this step you will see how to configure eclipse to work with all
them.

1. Lets first open a .tml for example index.tml. As we see eclipse thinks that
it is a simple .txt file, we have to explain him that that is a .tml file and it
has to be treated specially.

2. In the preferences window just add the file association *.tml


Now all .tml files will be treated as html files and we will be able to use a
html editor on them.
STEP 9 Fixing eclipse.ini file issue

The final step In this step we will just fix this problem that occurs when
starting eclipse.

He is telling us that some maven plugins are using jars from the JDK, and that
for some strange reason is disturbing eclipse. Also we notice that he says that
he cannot find the settings.xml file. Lets see what can we do about this:
1. Go to the folder where you installed eclipse and open the eclipse.ini
file

2. Edit the file to look like this(Do it exactly as it is shown otherwise will
not work):

Now eclipse will not show warnings never again at startup.


Dear colleges, I hope this helps you, and i wish you good luck with web programming.

Djordje Popovic
3rd year student in the Faculty for Information and Technology
Podgorica(Montenegro).
Email: djordje.popovic.fit@gmail.com

You might also like