Building and Running from Command-Line

The pom.xml file is a basic Maven build script for creating your microservice as an executable uber-jar.

The easiest way to build your microservice is to run the following from the project root.

mvn clean install

Your `target` directory should now contain the following files:

- `my-microservice-1.0.jar`
- `my-microservice.cfg`
- `jetty.xml`

To start from a command line, run the following command from inside your `target` directory:

java -jar my-microservice-1.0.jar

You should see the following console output:

Running class 'RestMicroservice' using config file 'my-microservice.cfg'. Server started on port 10000 List of available commands: exit -- Shut down service restart -- Restarts service help -- Commands help >

If you get this error message: `java.net.BindException: Address already in use`, then this microservice is already running elsewhere and so it cannot bind to port 10000.