我只是开始研究vert.x并从https://github.com/vert-x3/vertx-examples/tree/master/kotlin-examples/web下载了一个示例性Restful项目。根据自述文件,当文件有任何更改时,它应该能够自动重新部署,但似乎不起作用。无论我更改主类文件多少次,它仍然无法反射(reflect)出来。我所做的是:
运行“gradlew run”
C:\vertx-examples-master\kotlin-examples\web>gradlew run
:compileKotlin UP-TO-DATE
:compileJava UP-TO-DATE
:copyMainKotlinClasses UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:run
Jan 08, 2018 7:16:04 PM io.vertx.core.impl.launcher.commands.Watcher
INFO: Watched paths: [C:\vertx-examples-master\kotlin-examples\web\.\out]
Jan 08, 2018 7:16:04 PM io.vertx.core.impl.launcher.commands.Watcher
INFO: Starting the vert.x application in redeploy mode
Starting vert.x application...
58d1ec56-6d4c-4209-9fba-71cd6f54101c-redeploy
Jan 08, 2018 7:16:05 PM
io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle
更改源文件,启动器能够检测到更改,并说它重新部署了Verticle
Jan 08, 2018 7:16:46 PM io.vertx.core.impl.launcher.commands.Watcher
INFO: Redeploying!
Stopping vert.x application '58d1ec56-6d4c-4209-9fba-71cd6f54101c-redeploy'
Application '58d1ec56-6d4c-4209-9fba-71cd6f54101c-redeploy' terminated with
status 0
'.' is not recognized as an internal or external command,
operable program or batch file.
Jan 08, 2018 7:16:47 PM io.vertx.core.impl.launcher.commands.Watcher
INFO: User command terminated with status 1
Starting vert.x application...
58d1ec56-6d4c-4209-9fba-71cd6f54101c-redeploy
Jan 08, 2018 7:16:47 PM io.vertx.core.impl.launcher.commands.Watcher
INFO: Redeployment done in 966 ms.
Jan 08, 2018 7:16:48 PM
io.vertx.core.impl.launcher.commands.VertxIsolatedDeployer
INFO: Succeeded in deploying verticle
但实际上它仍在运行旧代码
我的问题是要使其正常工作,我需要做的任何事情。我花了一天时间浏览解决方案,但仍然无法解决。
非常感谢。
最佳答案
我有同样的问题,但确切地说是在此file的帮助下。我以此批处理文件结尾,该文件可以帮助我重新部署(在Windows上测试)。
我的项目的名称为: testws ,我的主版本名为: MainVerticle ,请确保将其替换为您自己的。
redeploy.bat
@echo off
SET LAUNCHER="io.vertx.core.Launcher"
SET VERTICLE="juan.testws.MainVerticle"
SET CMD="gradlew classes"
call gradlew copyDependencies
call gradlew classes
java -cp "build\dependencies\*;build\classes\kotlin\main" %LAUNCHER% run^
%VERTICLE% --redeploy="src\main\**\*" --on-redeploy=%CMD% --launcher-class=%LAUNCHER%
并添加了gradle任务
build.gradle
... // rest of the file
task copyDependencies(type: Copy) {
from configurations.default
into 'build\\dependencies'
}
在Java上几乎可以使用相同的版本,仅在文件上将“kotlin”替换为“java”。
关于gradle - 无法使vert.x + kotlin + gradle热重新部署有效,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48149368/