Vert.x Starter Not Working With Gradle

449 views
Skip to first unread message

Nick Apperley

unread,
Jan 21, 2017, 10:53:00 PM1/21/17
to vert.x
Working through the Vert.x tutorial series and have reached the bottom of the first blog post. Trying to run the Vert.x program (written in Kotlin 1.0.6) with Gradle via its run task and end up with the following output:



:compileKotlin UP-TO-DATE
:compileJava UP-TO-DATE
:copyMainKotlinClasses UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
Jan 22, 2017 4:42:15 PM io.vertx.core.Starter
INFO
:     vertx run <main> [-options]                                                
        runs a verticle called
<main> in its own instance of vert.x.        


    valid options are
:


// ....



Can run the program manually through java in the terminal just fine after executing the jar Gradle task. Below is the contents of build.gradle:

group 'io.vertx.blog'
version '0.1-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.0.6'

repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

apply plugin: 'kotlin'
apply plugin: 'application'


repositories {
mavenCentral()
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'io.vertx:vertx-core:3.3.3'
testCompile 'io.vertx:vertx-unit:3.3.3'
testCompile 'junit:junit:4.12'
}

run {
mainClassName = 'io.vertx.core.Starter'
}

jar {
from configurations.compile.collect { zipTree it }
manifest.attributes 'Main-Class': 'io.vertx.core.Starter'
manifest.attributes 'Main-Verticle': 'io.vertx.blog.first.MyFirstVerticle'
}



What is needed to get the Gradle run task to work successfully?

Asher Tarnopolski

unread,
Jan 22, 2017, 4:12:10 AM1/22/17
to vert.x
main-class should be io.vertx.core.Launcher

Alexander Lehmann

unread,
Jan 22, 2017, 6:47:16 AM1/22/17
to vert.x
Looks like this is wrong in the tutorial example, but its correct in the example code on github.

@Clement: could you take a look at the pom.xml in the blog text please?

Clement Escoffier

unread,
Jan 22, 2017, 1:13:30 PM1/22/17
to ve...@googlegroups.com
Hi,

The blog post has been written while we were using the Starter class. I had updated the source code, but yes… forgot the blog post.

Clement

-- 
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/23be5dff-a457-4ca3-b077-e2d28c1146b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nick Apperley

unread,
Jan 23, 2017, 9:01:45 PM1/23/17
to vert.x
Changed build.gradle file to the following:

// ...
def mainVerticle = 'io.vertx.blog.first.MyFirstVerticle'
def mainClass = 'io.vertx.core.Launcher'


run
{
    mainClassName
= mainClass
    args
= ['run', mainVerticle]
}
// ...




Can now get the program to run successfully.

Reply all
Reply to author
Forward
0 new messages