Moonshine introduces an organizational unit bigger than a class - Service
Execute
mvn archetype:generate \ -DarchetypeGroupId=org.atteo.moonshine \ -DarchetypeArtifactId=service-archetype
Add selected services to the POM file
<dependency> <groupId>org.atteo.moonshine</groupId> <artifactId>jetty</artifactId> </dependency> <dependency> <groupId>org.atteo.moonshine</groupId> <artifactId>resteasy</artifactId> </dependency>
Create file 'src/main/java/HelloWorldResource.java'
import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; @Path("/") @Produces("application/text") public class HelloWorldResource { @GET public String get() { return "Hello World!"; } }
Execute the following line from console:
mvn exec:java -Djetty.port=8080
Go to http://localhost:8080/ to see the result