• Stars
    star
    113
  • Rank 310,115 (Top 7 %)
  • Language
    Kotlin
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An opinionated Gradle plugin for Vert.x projects

Vert.x Gradle Plugin

An opinionated Gradle plugin for Vert.x projects.

Java CI with Gradle tag license Maven Central

What the plugin does

This plugin simplifies building and running Vert.x applications with Gradle.

It automatically applies the following plugins:

You can omit versions from elements in the https://github.com/vert-x3/vertx-stack[the Vert.x stack as the plugin references the corresponding Maven BOM.

Note
From version 0.9.0 the plugin no longer sets the sourceCompatibility to Java 8. You can set it manually like in other Java projects.

The plugin automatically adds io.vertx:vertx-core as a compile dependency, so you don’t need to do it.

The plugin provides a vertxRun task that can take advantage of the Vert.x auto-reloading capabilities, so you can just run it then have you code being automatically compiled and reloaded as you make changes.

Note
If you encounter issues with your application still being running in the background due to how the Gradle caching works, then you may try running the vertxRun task with gradle --no-daemon vertxRun.

The plugin provides a vertxDebug task enabling to debug your code.

Note
Reloading is disabled while debugging. Moreover in order to prevent warnings while in debug mode, Vert.x options maxEventLoopExecuteTime and maxWorkerExecuteTime are set to java.lang.Long.MAX_VALUE

Minimal example

plugins {
  id 'io.vertx.vertx-plugin' version 'x.y.z' // (1)
}

repositories {
  jcenter()
}

vertx {
  mainVerticle = 'sample.App'
}

Maven Central Replace x.y.z with a version available on the Gradle Plugin Portal

Provided sample.App is a Vert.x verticle, then:

  • gradle shadowJar builds an executable Jar with all dependencies: java -jar build/libs/simple-project-all.jar

  • gradle vertxRun starts the application and automatically recompiles (gradle classes) and reloads the code when any file under src/ is being added, modified or deleted.

A slightly more elaborated example

A project using vertx-web and logback would use a build.gradle definition like the following one:

plugins {
  id 'io.vertx.vertx-plugin' version 'x.y.z'
}

repositories {
  jcenter()
}

dependencies {
  compile "io.vertx:vertx-web" // (1)
  compile "ch.qos.logback:logback-classic:1.2.3" // (2)
}

vertx {
  mainVerticle = "sample.App"
  vertxVersion = "4.1.2" // (3)
}
  1. Part of the Vert.x stack, so the version can be omitted.

  2. Logback needs a version.

  3. You can override to point to any specific release of Vert.x.

Kotlin projects

This plugin works with Kotlin projects too:

plugins {
  id 'io.vertx.vertx-plugin' version 'x.y.z'
  id 'org.jetbrains.kotlin.jvm' version 'a.b.c'
}

repositories {
  jcenter()
}

dependencies {
  compile 'io.vertx:vertx-lang-kotlin'
  compile 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'  // (1)
}

vertx {
  mainVerticle = "sample.MainVerticle"  // (2)
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {   // (3)
  kotlinOptions {
    jvmTarget = "1.8"
  }
}
  1. This pulls all the Kotlin standard library dependencies for JDK 8+.

  2. This verticle can be written in Kotlin (or Java).

  3. By default Kotlin compiles to Java 6 bytecode, so it is worth changing all compilation tasks to match Java 8 bytecode.

Using Kotlin DSL

plugins {
  id("io.vertx.vertx-plugin") version "x.y.z"
}

repositories {
  jcenter()
}

vertx { // (1)
  mainVerticle = "sample.App"
}
  1. Extension method on org.gradle.api.Project.

Configuration

The configuration happens through the vertx Gradle extension.

The following configuration can be applied, and matches the vertx run command-line interface when possible:

Option Description Default value

vertxVersion

the Vert.x version to use

"4.1.2"

launcher

the main class name

io.vertx.core.Launcher

mainVerticle

the main verticle

""

args

a list of command-line arguments to pass

[]

config

either a file or direct JSON data to provide configuration

""

workDirectory

the working directory

project.projectDir

jvmArgs

extra JVM arguments

[]

redeploy

whether automatic redeployment shall happen or not

true

watch

Ant-style matchers for files to watch for modifications

[src/**/*]

onRedeploy

the Gradle tasks to run before redeploying

["classes"]

redeployScanPeriod / redeployGracePeriod / redeployTerminationPeriod

tuning for the redeployment watch timers

1000L (1 second each)

debugPort

The debugger port

5005L

debugSuspend

Whether or not the application must wait until a debugger is attached to start

false

The default values are listed in src/main/kotlin/io/vertx/gradle/VertxExtension.kt.

By default redeployment is enabled, running gradle classes to recompile, and watching all files under src/.

Licensing

Copyright 2017-2019 Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Credits

The plugin was originally created by Julien Ponge.

Thanks to the folks at Gradle for their guidance and technical discussions:

  • Cédric Champeau

  • Stefan Oheme

  • Rodrigo B. de Oliveira

  • Eric Wendelin

  • Benjamin Muschko

More Repositories

1

vertx-in-action

Examples for the Manning "Vert.x in Action" book
Java
254
star
2

lzma-java

[NOT MAINTAINED ANYMORE] LZMA library for Java
Java
72
star
3

izpack

(I no longer maintain this repository, please go to 'izpack/izpack')
Java
56
star
4

vertx-boot

An Eclipse Vert.x verticle to boot an application from HOCON configuration.
Java
44
star
5

vertx-go-tcp-eventbus-bridge

A Go Client for the Eclipse Vert.x TCP EventBus Bridge
Go
28
star
6

dotfiles

My dotfiles and configuration scripts
Shell
25
star
7

demo-vertx-kotlin-rxjava2-kubernetes

Demonstration of Eclipse Vert.x, Kotlin, RxJava2 and Kubernetes
Kotlin
24
star
8

boiler-vroom

Fun is fun, powered by Vert.x.
JavaScript
20
star
9

mutiny-workshop-examples

Java
15
star
10

todoapp-javaee6-angularjs

A todo list sample app made with Java EE 6 and AngularJS
JavaScript
11
star
11

oracle-javamag-vertx-rxjava

Java
10
star
12

guice-aspectj-sample

An example of Guice / AspectJ interaction
Java
7
star
13

run-with-privileges-on-osx

Tiny tool for running other programs with elevated privileges on Mac OS X.
C
7
star
14

vertx-devoxxfr19-demos

Vert.x demos for our session at Devoxx France 2019
Java
6
star
15

blobstore

A simple blob store in Java.
Java
5
star
16

pyappenginetodolist

A stupid todo lists manager for Google AppEngine / Python
Python
4
star
17

vim-golo

Golo Vim syntax
Vim Script
3
star
18

manning-twitch-october-2020

Java
3
star
19

qa-via-examples

Java
3
star
20

izpack-utils

IzPack utilities
Python
3
star
21

dlstats

DLStats - A NodeJS Product Downloads Stats System
JavaScript
3
star
22

vertx-elasticsearch-client

Moved to https://github.com/reactiverse/elasticsearch-client
3
star
23

aggregate-pom-gen

A simple tool to generate an aggregate Maven POM file from independent projects in sub-folders.
Go
3
star
24

build-graal-jvm

Script to build a JDK 8 image with Graal as a default compiler
Shell
2
star
25

izpack-launcher

IzPack native launcher
2
star
26

dm-greeter

Spring DM Greeter stupid example
2
star
27

ingolstadt-jug-january-2021

Java
2
star
28

phd-thesis-ubp-unsw-2008

Sources of my PhD thesis circa 2008 at Université Blaise Pascal (Clermont-Ferrand, France) and UNSW (Sydney, Australia)
TeX
2
star
29

time-to-boot-server

Measure the time to boot a server and make a first connection
Go
2
star
30

izpack-full-svn-history-copy

The complete set of revisions of the IzPack Subversion repository before we switched to Git. It does not contain tags and branches informations. This repository will never be updated again.
Java
2
star
31

tinyinjector

A tiny references injector for Java.
Java
2
star
32

todoapp-bosswatch

A sample Java EE 6 app that receives messages from jponge/todoapp-javaee6-angularjs
JavaScript
2
star
33

lavajug-19

Java
1
star
34

dynamic-reference

Dynamic references in Java
Java
1
star
35

vertx-poitoujug-june-2017-code

Vert.x live coding at the PoitouJUG 2017
Java
1
star
36

sample-minimal-spring-ioc

A sample minimal Spring/Core app.
Java
1
star
37

vertx-4-mutiny-sql-client

Java
1
star
38

dice-proxy

A simple transparent HTTP proxy that detects common search engine queries, and puts query data into a MongoDB database.
Scala
1
star
39

website

My personal website
SCSS
1
star
40

jponge.github.com

My profile page on GitHub.
JavaScript
1
star
41

vertx-elasticsearch-client-failed-experiment

This was an experimental work in progress of an Elasticsearch client for Eclipse Vert.x. Turned out that this was not the right way to do it...
Java
1
star
42

quarkus-extensions-playground

Java
1
star
43

java7-vagrant-box

A Java Vagrant Box
Vim Script
1
star
44

JavaEE-Examples

A few Java EE examples
Java
1
star
45

quarkus-hr-devservice

HTML
1
star
46

servicemosaic-protocols

Source code from the ServiceMosaic Protocols research project.
Java
1
star
47

rebls21-paper-benchmarks

Java
1
star
48

aop-samples

A bunch of AOP samples
Java
1
star