Running Jetty 9 with Ant

Posted by {"name"=>"Palash Ray", "email"=>"paawak@gmail.com", "url"=>"https://www.linkedin.com/in/palash-ray/"} on April 07, 2016 · 1 min read

We have a simple web application written in Spring MVC. Today, we will demo how to run the war through Ant, using Jetty 9. The needed libraries can either be manually downloaded and provided as a part of the project. However, sometimes, it becomes unwieldy, especially if you want to upgrade the Jetty version. So, we will define them as Maven dependencies in the build.xml.



	Deploys and runs an war file within Jetty
	
	
	
	
	
	
		
		
		
			
			
			
			
			
			
			
			
			
			
			
		
		
		
		
		
			
			
				
			
		
	

The beauty of defining the required jars as Maven dependencies is, that these jars will be downloaded in local Maven repository if not present.
Note that we define the location of the war file. Also, we define a custom port and a context path.
The source code can be found here:
https://github.com/paawak/blog/tree/master/code/simple-spring-rest