Bootstrap a simple Dropwizard(.io) application

This commit is contained in:
R. Tyler Croy 2016-12-18 10:16:53 -08:00
parent d026153e8a
commit ac6907c5f1
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
4 changed files with 75 additions and 5 deletions

View File

@ -1,15 +1,34 @@
plugins {
/* Used for generating version manifests for the applications */
id 'org.ajoberstar.grgit' version '1.6.0'
/* Used for rendering the documentation for the applications */
id 'org.asciidoctor.gradle.asciidoctor' version '1.5.1'
}
/* Application plugin for creating tarballs of our app */
apply plugin: 'application'
/* Groovy plugin sets up the tasks for building the Groovy app */
apply plugin: 'groovy'
/* Enforce code-style checks on the Groovy code */
apply plugin: 'codenarc'
/* Set some basic project properties */
version = '0.0.1'
group = 'io.lasagna'
description = 'HttpWizard is a simple application for playing with HTTP'
mainClassName = 'io.lasagna.httpwizard.HttpWizard'
/* Force our target compatibility to JDK8 always */
project.targetCompatibility = 1.8
/**********************************************************************/
repositories {
jcenter()
}
dependencies {
compile localGroovy()
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.18'
compile "io.dropwizard:dropwizard-core:${dropwizardVersion}"
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the

1
gradle.properties Normal file
View File

@ -0,0 +1 @@
dropwizardVersion=1.0.5

View File

@ -18,9 +18,27 @@
package io.lasagna.httpwizard
import io.dropwizard.Application
import io.dropwizard.setup.Bootstrap
import io.dropwizard.setup.Environment
class HttpWizard {
static void main(String[] argv) {
println 'Hello world'
/**
* HttpWizard is the main Dropwizard application class
*/
class HttpWizard extends Application<HttpWizardConfiguration> {
/** Run the HttpWizard application */
static void main(String[] args) throws Exception {
new HttpWizard().run(args)
}
@Override
void run(HttpWizardConfiguration configuration,
Environment env) {
/* nothing to do yet */
}
@Override
void initialize(Bootstrap<HttpWizardConfiguration> bootstrap) {
/* nothing to do yet */
}
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2016 R. Tyler Croy <tyler@linux.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package io.lasagna.httpwizard
import io.dropwizard.Configuration
import org.hibernate.validator.constraints.NotEmpty
/**
* HttpWizardConfiguration contains the basic configuration schema for the
* application
*/
class HttpWizardConfiguration extends Configuration {
@NotEmpty
private String appVersion
}