How To Survive The First Encounter With Tapestry. Installation Process Step by Step. (By: Djordje Popovic)
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.
2. After the JDK is downloaded, perform the installation(I think there is no need to
explain the installation in depth)
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.
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/ ).
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
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.
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.
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.
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)
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
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.
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):
Djordje Popovic
3rd year student in the Faculty for Information and Technology
Podgorica(Montenegro).
Email: [email protected]