Hello World - Create the project

In this tutorial we'll use maven to create a really simple hello world application.

Full source code for this tutorial is in github

Start by creating a maven project and adding milton-server-ce as a dependency and include jetty to run the server:

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>io.milton.tuts</groupId>
    <artifactId>tuts-anno1</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>tuts-anno1</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- Check for the latest version here: http://milton.io/downloads/index.html -->
        <milton.version>2.4.1.2</milton.version>
    </properties>

    <repositories>
        <repository>
            <id>milton-repo</id>
            <url>http://milton.io/maven/</url>
        </repository>       
    </repositories>  

    <build>
        <plugins>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <configuration>
                    <contextPath>/</contextPath>
                    <connectors>
                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                            <!--<port>8085</port>-->
                            <port>8080</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                    <stopKey>stop</stopKey>
                    <stopPort>8089</stopPort>
                </configuration>
            </plugin>            
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.milton</groupId>
            <artifactId>milton-server-ce</artifactId>
            <version>${milton.version}</version>
        </dependency>     
    </dependencies>
</project>