´´´
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id 'io.vertx.vertx-plugin' version '1.2.0'
}
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
compile 'io.vertx:vertx-web-client:4.0.2'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:29.0-jre'
// Use JUnit test framework
testImplementation 'junit:junit:4.13'
}
vertx {
mainVerticle = 'Reactx.BackendVerticle'
}
//Backend Verticle.java
/*
* This Java source file was generated by the Gradle 'init' task.
*/
package Reactx;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
public class BackendVerticle extends AbstractVerticle {
#Override
public void start() {
// Create an HTTP server which simply returns "Hello World!" to each request.
// If a configuration is set it get the specified name
Router router = Router.router(vertx);
Route messageRoute = router.get("/api/message"); // (1)
messageRoute.handler(rc -> {
rc.response().end("Hello React from Vert.x!"); // (2)
});
router.get().handler(StaticHandler.create()); // (3)
vertx.createHttpServer()
.requestHandler(router)
.listen(8080);
}
// tag::main[]
public static void main(String[] args) {
Vertx vertx = Vertx.vertx(); // <1>
vertx.deployVerticle(new BackendVerticle()); // <2>
}
// end::main[]
}
´´´
When I try to do gradle run, I am getting an error::compileJava Task failed.
How can this be solved? I cannot try kotlin because I have some dependency and I want to execute this only in gradle.build. I am using gradle version 6.6 which is also due to the dependency of project.
Adding failure stacktrace:
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
You are missing the vertx-web as a dependency.
To fix the compilation issues you need to add:
dependencies {
//...
compile 'io.vertx:vertx-web:4.0.2'
}
Related
this error randomly popped up after i tried running my ionic cordova app. this not only happens on my branch ive been working on but also with every other branch i try to run, which leads me to believe it is something with my machine. ive tried restarting and reinstalling the packages and it hasnt solved the issue.
> ionic-app-scripts.cmd build --target cordova --platform android
[23:25:18] ionic-app-scripts 3.2.4
[23:25:18] build dev started ...
[23:25:18] clean started ...
[23:25:18] clean finished in 21 ms
[23:25:18] copy started ...
[23:25:18] deeplinks started ...
[23:25:18] deeplinks finished in 515 ms
[23:25:18] transpile started ...
[23:25:25] transpile finished in 6.59 s
[23:25:25] preprocess started ...
[23:25:25] preprocess finished in less than 1 ms
[23:25:25] webpack started ...
[23:25:25] copy finished in 7.26 s
[23:25:30] webpack finished in 5.09 s
[23:25:30] sass started ...
[23:25:32] sass finished in 1.82 s
[23:25:32] postprocess started ...
[23:25:32] postprocess finished in 14 ms
[23:25:32] lint started ...
[23:25:32] build dev finished in 14.19 s
no-unused-variable is deprecated. Since TypeScript 2.9. Please use the built-in compiler checks instead.
[23:25:36] lint finished in 4.22 s
> cordova.cmd build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: C:\Users\IvanTzenev\AppData\Local\Android\sdk
Subproject Path: CordovaLib
Subproject Path: app
> Task :app:compileDebugJavaWithJavac FAILED
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\com\ionicframework\cordova\webview\IonicWebViewEngine.java:11: error: package android.support.annotation does not exist
import android.support.annotation.RequiresApi;
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic.java:57: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_External_Storage.java:28: error: cannot find symbol
import android.support.v4.os.EnvironmentCompat;
^
symbol: class EnvironmentCompat
location: package android.support.v4.os
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:35: error: cannot find symbol
import android.support.v4.app.NotificationManagerCompat;
^
symbol: class NotificationManagerCompat
location: package android.support.v4.app
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:40: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CordovaUri.java:25: error: package android.support.v4.content does not exist
import android.support.v4.content.FileProvider;
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\FileProvider.java:21: error: package android.support.v4.content does not exist
public class FileProvider extends android.support.v4.content.FileProvider {}
^
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\com\ionicframework\cordova\webview\IonicWebViewEngine.java:137: error: cannot find symbol
#RequiresApi(Build.VERSION_CODES.LOLLIPOP)
^
symbol: class RequiresApi
location: class IonicWebViewEngine.ServerClient
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic.java:648: error: cannot find symbol
java.lang.reflect.Method method = ActivityCompat.class.getMethod("shouldShowRequestPermissionRationale", Activity.class, java.lang.String.class);
^
symbol: class ActivityCompat
location: class Diagnostic
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_External_Storage.java:216: error: cannot find symbol
addPath = Environment.MEDIA_MOUNTED.equals(EnvironmentCompat.getStorageState(file));
^
symbol: variable EnvironmentCompat
location: class Diagnostic_External_Storage
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:123: error: cannot find symbol
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this.cordova.getActivity().getApplicationContext());
^
symbol: class NotificationManagerCompat
location: class Diagnostic_Notifications
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\cordova\plugins\Diagnostic_Notifications.java:123: error: cannot find symbol
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(this.cordova.getActivity().getApplicationContext());
^
symbol: variable NotificationManagerCompat
location: class Diagnostic_Notifications
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:303: error: cannot find symbol
this.imageUri = new CordovaUri(FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
C:\GitHub\Accentis-Ionic\platforms\android\app\src\main\java\org\apache\cordova\camera\CameraLauncher.java:801: error: cannot find symbol
Uri tmpFile = FileProvider.getUriForFile(cordova.getActivity(),
^
symbol: method getUriForFile(Activity,String,File)
location: class FileProvider
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
14 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> 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.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
21 actionable tasks: 1 executed, 20 up-to-date
Command failed with exit code 1: C:\GitHub\Accentis-Ionic\platforms\android\gradlew cdvBuildDebug -b C:\GitHub\Accentis-Ionic\platforms\android\build.gradle
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
i think you are missing these v4 libraries or dependencies are not getting sync properly. first thing you can invalidate/restart(file menu in Android studio) your project and if still not working then can check below link: package android.support.v4.app does not exist ; in Android studio 0.8
I cannot build after updating flutter and andriodX. I keep gettng the error below with a lots of warning messages. I upgraged flutter. I also executed flutter doctor. It has not helped.
The app was working fine and in order to user Firebase authentication,I created SHA1. After that it stopped working. Please suggest. I have looked over all other similar questions but I can't seem to find a solution.
Note: C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\firebase_core_web-0.1.1+2\android\src\main\java\io\flutter\plugins\firebase_core_web\FirebaseCoreWebPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.7+3\android\src\main\java\io\flutter\plugins\sharedpreferences\SharedPreferencesPlugin.java:18: warning: [deprecation] Registrar in PluginRegistry has been deprecated
public static void registerWith(PluginRegistry.Registrar registrar) { ^
1 warning
C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:31: error: cannot find symbol
private ThreadedInputConnectionProxyAdapterView proxyAdapterView;
^
symbol: class ThreadedInputConnectionProxyAdapterView
location: class InputAwareWebView
C:\Users\username\AppData\Local\Pub\Cache\hosted\pub.dartlang.org\webview_flutter-2.0.6\android\src\main\java\io\flutter\plugins\webviewflutter\InputAwareWebView.java:112: error: cannot find symbol
new ThreadedInputConnectionProxyAdapterView(
^
symbol: class ThreadedInputConnectionProxyAdapterView
location: class InputAwareWebView
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':webview_flutter:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
BUILD FAILED in 2m 22s
Exception: Gradle task assembleDebug failed with exit code 1
gradle.properties
android.useAndroidX=true
android.enableJetifier=true
New to Gradle. I Apologize if this is a bad question.
I've been trying to start a plain Java8 Gradle project. Everything was great until I tried to add Lombok to my project.
My Intellij IDE has all the settings required for Lombok.
Lombok plugin installed and activated
Annotation processor is on
The IDE is handling the annotations perfectly. No errors showing, and the boilerplate is shown in the code structure.
However, when I try to build the project or run the main method using Intellij, the compiler complains that the boilerplate Lombok is supposed to generate doesn't exist.
Environment
186590cf4989:JokerJava$ gradlew --version
------------------------------------------------------------
Gradle 5.2.1
------------------------------------------------------------
Build time: 2019-02-08 19:00:10 UTC
Revision: f02764e074c32ee8851a4e1877dd1fea8ffb7183
Kotlin DSL: 1.1.3
Kotlin: 1.3.20
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM: 11.0.5 (Oracle Corporation 11.0.5+10-LTS)
OS: Mac OS X 10.14.6 x86_64
Some error message below:
8:23:21 PM: Executing task 'build'...
> Task :generateLombokConfig UP-TO-DATE
> Task :compileJava FAILED
2 actionable tasks: 1 executed, 1 up-to-date
warning: You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.
Your processor is: org.gradle.api.internal.tasks.compile.processing.IncrementalProcessingEnvironment
Lombok supports: sun/apple javac 1.6, ECJ
workspace/tank/JokerJava/src/main/java/tictactoe/game/gui/TicTacToeButton.java:11: error: variable index not initialized in the default constructor
private final int index;
^
workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:42: error: constructor TicTacToeButton in class TicTacToeButton cannot be applied to given types;
buttons[i] = new TicTacToeButton(i);
^
required: no arguments
found: int
reason: actual and formal argument lists differ in length
/workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:70: error: cannot find symbol
int index = buttonClicked.getIndex();
^
symbol: method getIndex()
location: variable buttonClicked of type TicTacToeButton
/workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:86: error: cannot find symbol
update(opponentAction.getPlayer(), opponentAction.getIndex());
^
symbol: method getPlayer()
location: variable opponentAction of type UserAction
/workspace/tank/JokerJava/src/main/java/tictactoe/game/TicTacToe.java:86: error: cannot find symbol
update(opponentAction.getPlayer(), opponentAction.getIndex());
^
symbol: method getIndex()
location: variable opponentAction of type UserAction
Note: /workspace/tank/JokerJava/src/main/java/Client.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
5 errors
1 warning
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
BUILD FAILED in 1s
8:23:22 PM: Task execution finished 'build'.
See below for my build.gradle config
plugins {
id 'java'
id "io.freefair.lombok" version "5.0.0-rc2"
}
group 'org.example'
version '1.0-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
}
Even if you don't want to use spring, head over to the spring Initializer at https://start.spring.io/ and choose Gradle and add the Lombok dependency. It'll create a build.gradle for you with Lombok in the appropriate configurations (including annotationProcessor)
Gradle throws a NoClassDefFoundError when trying to execute a grgit task.
Start of build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'org.ajoberstar:gradle-git:1.2.0'
}
}
apply plugin: 'com.android.application'
//
//
import org.ajoberstar.grgit.*
task clone << {
File dir = new File('contrib/otherstuff')
if(!dir.exists()) {
def grgit = Grgit.clone(dir: dir, uri: 'https://github.com/someguy/otherstuff.git')
}
// TODO else (pull)
}
project.afterEvaluate {
preBuild.dependsOn clone
}
// rest omitted
Output:
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:src:myproject:clone FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/home/me/src/myproject/build.gradle' line: 20
* What went wrong:
Execution failed for task ':src:myproject:clone'.
> java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 16.937 secs
Line 20 is the call to Grgit.clone().
Do I need to add groovy as a build dependency (which the error message seems to indicate)? How and where would I add it?
EDIT: gradle version is 1.10, if it matters.
As #user149408 pointed out the Gradle version (v1.10 vs v2.10) mismatch, I dug a little bit further:
gradle-git-plugin commit for v0.7.0 specifies the Gradle version used (v1.11), so the build with v1.10 works fine.
Because the Gradle plugin always built with compile localGroovy() and compile gradleApi() which comes from Gradle, then if it builds with Gradle 2.x, it would incur the Groovy mismatch error.
What went wrong: Execution failed for task ':src:myproject:clone'.
java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
In fact, the combo of Gradle v2.10 and gradle-git v1.2.0 just works fine.
Some sample build.gradle similar structure as in the question.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ajoberstar:gradle-git:1.2.0'
}
}
import org.ajoberstar.grgit.*
task clone << {
File dir = new File('contrib/gs-spring-boot')
if(!dir.exists()) {
def grgit = Grgit.clone(dir: dir, uri: 'https://github.com/chenrui333/gs-spring-boot.git')
}
// TODO else (pull)
}
./gradlew clone would give you:
$ ls contrib/gs-spring-boot/
CONTRIBUTING.adoc LICENSE.code.txt LICENSE.writing.txt README.adoc complete initial test
Hope it helps!
I’ve managed to solve it.
grgit-1.2.0 appears to depend on groovy. Adding a classpath entry for groovy in the buildscript/dependencies block resulted in a different error:
Relying on packaging to define the extension of the main artifact has been deprecated and is scheduled to be removed in Gradle 2.0
:src:myproject:clone FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/home/me/src/myproject/build.gradle' line: 23
* What went wrong:
Execution failed for task ':src:myproject:clone'.
> java.lang.IncompatibleClassChangeError: the number of constructors during runtime and compile time for org.ajoberstar.grgit.auth.AuthConfig$Option do not match. Expected -1 but got 2
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 12.295 secs
Further research revealed that this might stem from a version incompatibility (as I’m stuck with Gradle 1.10 for other reasons).
Eventually I solved it by going back to grgit-0.7.0. Now my git task works and the repo gets cloned.
I have a problem. When I compile my app with maven, I'm receiving following error:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
(default-compile) on project myproject-core: Compilation failure
[ERROR]
/home/group/Check/19-01-2017---13-40-59/myproject/src/main/java/repository/dao/documents/FileDAO.java:[213,24]
error: cannot access Comparable
in this line and column there are:
public Integer insertFile(File file) throws Exception {
Properties p = Util.getProperties("prop.properties");
MyFacade.setup(p.getProperty("url).toString(),
Integer.valueOf(p.getProperty("port").toString()).intValue(), p.getProperty("service").toString(),
p.getProperty("user").toString(), p.getProperty("pwd").toString());
final DocumentsFile documentFile = MyFacade.creaFile(p.getProperty("codDoc").toString(), file);
MyFacade.teardown();
return documentFile.getId(); //this is the line 213}
What could be the problem?
Thanks for the response
I had a similar problem ("Cannot access" some interface) due to a misalignment in java version. But I had to update the compiler plugin (to 3.10) to get it to indicate that the class file version was too advanced (java 17) for what I was using in my project (Java 11) instead of just "cannot access".