Java 尝试运行vertx应用程序时Gradle build出现问题
'Java 尝试运行vertx应用程序时Gradle build出现问题,java,gradle,vert.x,Java,Gradle,Vert.x,' 您缺少作为依赖项的vertx web 要解决编译问题,您需要添加: Gradle Version: 6.6 Java Home: C:\...\jdk1.8.0_282 JVM Arguments: None Program Arguments: None Build Scans Enabled: false Offline Mode Enabled: false Gradle Tasks: run > Task :compileJava FAILED C:\CMWorkspace
您缺少作为依赖项的
vertx web
要解决编译问题,您需要添加:
Gradle Version: 6.6
Java Home: C:\...\jdk1.8.0_282
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: run
> Task :compileJava FAILED
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:8: error: package io.vertx.ext.web does not exist
import io.vertx.ext.web.Route;
^
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:9: error: package io.vertx.ext.web does not exist
import io.vertx.ext.web.Router;
^
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:10: error: package io.vertx.ext.web.handler does not exist
import io.vertx.ext.web.handler.StaticHandler;
^
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:18: error: cannot find symbol
Router router = Router.router(vertx);
^
symbol: class Router
location: class BackendVerticle
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:18: error: cannot find symbol
Router router = Router.router(vertx);
^
symbol: variable Router
location: class BackendVerticle
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:19: error: cannot find symbol
Route messageRoute = router.get("/api/message"); // (1)
^
symbol: class Route
location: class BackendVerticle
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:24: error: cannot find symbol
router.get().handler(StaticHandler.create()); // (3)
^
symbol: variable StaticHandler
location: class BackendVerticle
7 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 253ms
1 actionable task: 1 executed
你能提供更多关于失败的细节吗?@homerman添加了失败跟踪。看一看!您应该添加
编译'io.vertx:vertxeb:4.0.2'
dependency@injecteer如果您看到我上面的代码,我已经添加了dependency,如果您这样做了,您将消除编译错误。您添加了olnyvertxeb客户端
Gradle Version: 6.6
Java Home: C:\...\jdk1.8.0_282
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: run
> Task :compileJava FAILED
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:8: error: package io.vertx.ext.web does not exist
import io.vertx.ext.web.Route;
^
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:9: error: package io.vertx.ext.web does not exist
import io.vertx.ext.web.Router;
^
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:10: error: package io.vertx.ext.web.handler does not exist
import io.vertx.ext.web.handler.StaticHandler;
^
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:18: error: cannot find symbol
Router router = Router.router(vertx);
^
symbol: class Router
location: class BackendVerticle
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:18: error: cannot find symbol
Router router = Router.router(vertx);
^
symbol: variable Router
location: class BackendVerticle
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:19: error: cannot find symbol
Route messageRoute = router.get("/api/message"); // (1)
^
symbol: class Route
location: class BackendVerticle
C:\CMWorkspaceUpdated\Reactx\src\main\java\Reactx\BackendVerticle.java:24: error: cannot find symbol
router.get().handler(StaticHandler.create()); // (3)
^
symbol: variable StaticHandler
location: class BackendVerticle
7 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.6/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 253ms
1 actionable task: 1 executed
dependencies {
//...
compile 'io.vertx:vertx-web:4.0.2'
}