In this document we outline how to create a new lift project and deploy it on Jetty. The approach shown here is a temporary approach recommended for Windows developers. The preferred approach of using lifty is currently not working in the Windows environment.
Learning Something tutorials like this one are prepared while I am learning something new. Because I am a newbie at whatever I am learning, these tutorials tend to be very basic. They are step-by-step instructions prepared by a newbie. Consequently, they may not show the best way to do something. They just show how I understood things at the time. Still, I hope you will benefit from my sharing of these tutorials and I hope you will add comments where you know a better way so we can all learn from each other.
I hope you enjoy and benefit from the Learning Something tutorials. Enjoy!
Create a working directory in which you want to store your Lift project. My working directory is c:\$work\lift projects.
Launch Git Gui and click the Clone Existing Repository link on the home screen (second link from top in the image below).
Git Gui will launch the Clone Existing Repository screen shown below.
Enter the following details in the available fields:
Target Directory: Enter the name of the directory you want Git Gui to create for your project. In our case, we want to call our project HelloLift, so let’s set our target directory name to
c:\$work\lift projects\hellolift. Be sure that the subdirectory hellolift does not exist yet; Git Gui will create the directory for us.
Once you have entered the source and target information, the Git Gui screen should be similar to the image below.
Click the Clone button to clone the Lift prototype project to your working directory.
Git Gui displays a dialog box while it cloning the requested prototype project, as shown below.
Once the project is cloned Git Gui will display its main working window as shown below:
The Git Gui window title indicates that we are in the project directory of the hellolift project. Below the menu bar we can see that master is the current branch. Below the branch name, Git Gui shows any Unstaged Changes in this branch. Below that again, Git Gui shows any Staged Changes. Since we have not made any changes to the application both lists are empty at the moment.
Click Repository in the Git Gui menu bar and select Explore Working Copy. Git Gui will launch the project directory in an Explorer window as shown below.
As shown above, Git Gui has created our project directory
hellolift in our target directory
If you are curious feel free to navigate through the folders in the hellolift project directory to see the files Git has cloned for us.
Open a new command prompt as shown below.
Use the cd command to navigate to the project directory. In my case, the cd command is as follows:
cd c:\$work\lift projects\hellolift
You will need to adjust the
cd command to use your project directory name.
Once you enter the above
cd command and click enter, the command prompt should show that you are in the project directory as shown below:
We will use SBT (Simple Build Tool) to deploy the project. Type
sbt and click enter at the command prompt as shown below.
Click the enter key and SBT will run as shown below.
Notice that SBT has retrieved 17 artifacts for us, recompiled and built our project all from one command. Also notice that the SBT command prompt is displayed (after the last info line). This lets us know that SBT is running and waiting for our next instruction.
At the SBT prompt type
update and click enter. SBT will update your project to include the necessary files. Once update is complete you will see the command prompt as shown below. This will take some time (in my case 25 seconds) so be patient.
At the SBT prompt type
jetty-run and click enter. SBT will deploy your application to the Jetty server. The command prompt should appear as shown below.
Our application is now running on the Jetty server. We will view the application in our browser in the next step.
As we can see from the information in the Command Prompt,
jetty-run has been successful. A few lines above the success message, you can see that the users table has been created. All of this was done for us by Lift and SBT.
Now that our application is running, let’s go take a look at it. Launch your favourite browser and point it to http://localhost:8080/ to view your application as shown in the image below.
Congratulations, you have successfully cloned the prototype project and got it running on the Jetty server at your local host.
As a next step, click around the menu in your new Web Application and see what’s available. Also, look around in the project directory and become familiar with the various parts that make up the application.
Once your done, check out the appendix below and then go to HelloLift Lesson 2 when you are ready.
In case you are wondering, you can stop the Jetty server by entering jetty-stop in the Command Prompt window as shown below.
Once you have entered jetty-stop as shown above, click the enter key to stop server as shown below.
We are now back at the SBT prompt.
In case you are wondering, we can exit from the SBT prompt by typing exit at the SBT prompt as shown below.
Now click enter to submit the exit command as shown below.
As we can see in the image above our SBT session has completed and we are back at the Windows Command Prompt in our project directory. Typing exit and hitting enter from here will close the Windows Command Prompt.
Copyright 2010-2011, Hani Massoud. All rights reserved. Article copyright and all rights retained by the author.
Comments are closed for this blog post