jponge / vertx-gradle-plugin

An opinionated Gradle plugin for Vert.x projects
Apache License 2.0
113 stars 15 forks source link

Problems with vertxRun task #22

Open bgurung opened 5 years ago

bgurung commented 5 years ago

Hi,

I have the following in build.gradle:

vertx {
    mainVerticle = 'com.sample.SampleService'
}

vertxDebug {
    jvmArgs = ['-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory']
}

vertxRun {
    jvmArgs = ['-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory']
}

When I use vertxDebug, it works as expected.

But when I use vertxRun, I see the following issues:

  1. The specified jvmArgs is not passed along.
  2. On the command window, termination using [Ctrl] + [C] does not kill server. It keeps running in the background, and I get BindException because the port is occupied.

I am using Windows 10 and Java 8.

jponge commented 5 years ago

Hi, what versions of Gradle and the plugin are you using?

bgurung commented 5 years ago

Gradle 4.8 and PlugIn: 0.1.0. I switch to shadowjar plugin, and I don't see that issue with it. It's only with this plugin that I have to kill the process manually after stopping it, both on the IDEA or on CMD window (Ctrl+C).

mpodlodowski commented 5 years ago

I can confirm that issue. The same configuration runs great on Linux/OSX but fails on Windows 10/Java 8.

vertxDebug works, but vertxRun does not pass proper jvmArgs.

duruer commented 4 years ago

Is there any new on this issue? @jponge Because I can confirm same issue too.

jponge commented 4 years ago

How about with a recent version?

duruer commented 4 years ago

Gradle: 6.0.1 Vertx Gradle Plugin: 1.0.1 JDK: 8 8u231 OS: Windows 10

Everything is pretty updated.

jponge commented 4 years ago

Plain Windows or WSL?

Sorry I can’t test on Windows.

duruer commented 4 years ago

Plain Windows.

duruer commented 4 years ago

There is no problem with vertxDebug but with vertxRun there is.

jponge commented 4 years ago

In VertxPlugin.kt the flags are being passed.

Perhaps you could investigate?

On 10 Jan 2020, at 18:32, Ahmet Enes Duruer notifications@github.com wrote:

There is no problem with vertxDebug but with vertxRun there is.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

duruer commented 4 years ago

I'm sorry but I quite don't know how to investigate this issue even I know Kotlin. But I can help about testing and debugging I guess.

jponge commented 4 years ago

Ok I've made a quick sample:

package sample;

import io.vertx.core.Vertx;
import io.vertx.core.AbstractVerticle;

public class App extends AbstractVerticle {

  @Override
  public void start() {
    String message = System.getProperty("message", "You fail");
    vertx
      .createHttpServer()
      .requestHandler(req -> req.response().end(message)).listen(18080);
  }
}

with the following Gradle bits:

// (...)

vertx {
  mainVerticle = 'sample.App'
  jvmArgs = ['-Dmessage=Vert.x']
}

Then I ran: gradle vertxRun and did a HTTP request:

http :18080
HTTP/1.1 200 OK
content-length: 6

Vert.x

Works for me...

duruer commented 4 years ago

Is the Ctrl + C working?

jponge commented 4 years ago

Yes, Gradle reacts fine to SIGINT

On 10 Jan 2020, at 22:18, Ahmet Enes Duruer notifications@github.com wrote:

Is the Ctrl + C working?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jponge commented 4 years ago

All reports point to Windows. I don't have a Windows machine and the issue does not seem reproducible on any Unix system.

Until somebody with Windows expertise volunteers to look what could be wrong, I'll put this issue on hold.

duruer commented 4 years ago

Well, I'm not a Windows expert but yeah everything works fine on Unix system and moreover yeah all issues targeting to the Windows and they are not producable in Unix. In fact unfourtanetly I can only try the code.

Somiona commented 4 years ago

I'm using windows 18363.815 and for now even if running following code:

def mainVerticleName = 'com.MainVerticle'
def watchForChange = 'src/**/*'
def doOnChange = './gradlew classes'

run {
  args = ['run', mainVerticleName, "--redeploy=$watchForChange", "--launcher-class=$mainClassName", "--on-redeploy=$doOnChange"]
}

, Ctrl + C does not work properly. I'm thinking there's someting went wrong with watchOnChange, or vert.x didn't receive stop signal.

re-thc commented 3 years ago

Pretty sure the problem is with the Vertx launcher code and not specifically this gradle plugin. If you run it without gradle the same problem occurs in Windows.