Sonarlint Gradle Task - Execution failed for task ':sonarlintMain' - java

Trying to use 'sonarlintMain' using Gradle 7.0.2_2 on 'openjdk version "15.0.2" 2021-01-19'
id ("name.remal.sonarlint") version "1.3.1"
Runs & displays:
> Task :sonarlintMain
219 SonarLint violations were found
[rank 1] [java:S2095] /Users/NOTiFY/IdeaProjects/GoStopHandle/src/main/java/com/gostophandle/ejb/DatabaseSchemaJSON.java:115:30
Resources should be closed
Connections, streams, files, and other classes that implement the Closeable interface or its
super-interface, AutoCloseable, needs to be closed after use. Further, that close call must be
made in a finally block otherwise an exception could keep the call from being made. Preferably,
when class implements AutoCloseable, resource should be created using "try-with-resources"
pattern and will be closed automatically.
Failure to properly close resources will result in a resource leak which could bring first the
application and then perhaps the box the application is on to their knees.
etc ...
At end shows:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sonarlintMain'.
> 219 SonarLint violations were found
* 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 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 32s
Publishing a build scan to scans.gradle.co:
1 task failure
The :sonarlintMain task failed.View task in console log
219 SonarLint violations were found

Found: https://remal.gitlab.io/gradle-plugins/plugins/name.remal.sonarlint/
Added:
sonarlint {
ignoreFailures = true
}
Runs:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 34s
18 actionable tasks: 16 executed, 2 up-to-date
Need more documentation etc. but will pass for the time.

Related

Task :app:compileDebugJavaWithJavac FAILED issue due to rg.wonday.orientation.OrientationPackage

I am facing the following issue while running command : 'react-native run-android' , I have tried to make changes in '/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java' but it automatically get reset when running the command. Can anyone please help?
> Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
665 actionable tasks: 77 executed, 588 up-to-date
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:63: error: a type with the same simple name is already defined by the single-type-import of OrientationPackage
import org.wonday.orientation.OrientationPackage;
^
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:158: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:159: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
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.
3 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
BUILD FAILED in 1m 25s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:63: error: a type with the same simple name is already defined by the single-type-import of OrientationPackage
import org.wonday.orientation.OrientationPackage;
^
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:158: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:159: error: reference to OrientationPackage is ambiguous
new OrientationPackage(),
^
both class com.github.yamill.orientation.OrientationPackage in com.github.yamill.orientation and class org.wonday.orientation.OrientationPackage in org.wonday.orientation match
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.
3 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
BUILD FAILED in 1m 25s
I have tried to make changes in '/Users/ankitkumar/teachersapp_new/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java' but it automatically get reset when running the command and the build is unsuccessful.
Follow below steps and check if same issue still exist
If you did any manual linking like mentioned here then revert back all the changes
Run npx react-native unlink react-native-orientation
Run npm uninstall react-native-orientation
Delete node_modules
Delete build folders (android/build & android/app/build)
Run npm install or yarn to install packages
Check if app builds without react-native-orientation package.If yes, goto next next. If no, add the fix mentioned here React Native Android build failure with different errors without any changes in code for past days due to publish of React Native version 0.71.0-rc.0 then check if app works then, execute next step
run npm install react-native-orientation
Run npx react-native link react-native-orientation
Clean & build

how to fix "gradlew genSources"

I'm on windows 10, when I do "gradlew genSources" then this happened
Starting a Gradle Daemon, 7 stopped Daemons could not be reused, use --status for details
> Configure project :
Fabric Loom: 0.10.66
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\user\Downloads\MCJAVA\vector-addon\build.gradle'
* What went wrong:
Could not compile build file 'C:\Users\user\Downloads\MCJAVA\vector-addon\build.gradle'.
> startup failed:
General error during conversion: Unsupported class file major version 62
java.lang.IllegalArgumentException: Unsupported class file major version 62
1 error
* 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 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 5s
I want to know how can i fix it and im not good at coding and my english is not that good, I still tried with --stacktrace it still have similir error please help me
(its have a lot more text in code but its too much and i dont think it important)

compileReleaseJavaWithJavac' task (current target 1.7) and 'compileReleaseKotlin' task (current target 1.8) jvm target compatibility should be same

I'm Using a third party library as a jar download in my project called "bandlibrary". Getting following error.
[root#ip-172-31-23-189 hsandroidconsumer]# ./gradlew assembleABCRelease
Configuration on demand is an incubating feature.
Configure project :app
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
WARNING: API 'variant.getMappingFile()' is obsolete and has been replaced with 'variant.getMappingFileProvider()'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see https://d.android.com/r/tools/task-configuration-avoidance.
To determine what is calling variant.getMappingFile(), use -Pandroid.debug.obsoleteApi=true on the command line to display more information.
Task :bandlibrary:compileReleaseKotlin FAILED
'compileReleaseJavaWithJavac' task (current target is 1.7) and 'compileReleaseKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':bandlibrary:compileReleaseKotlin'.
Kotlin could not find the required JDK tools in the Java installation. Make sure Kotlin compilation is running on a JDK, not JRE.
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 1m 29s
23 actionable tasks: 1 executed, 22 up-to-date

Execution failed for task ':app:mergeDebugNativeLibs'. ... starting run-android failing last 3 days with no solution to it

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 870 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
daemon not running; starting now at tcp:5037
daemon started successfully
info Installing the app...
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details
Task :app:compileDebugJavaWithJavac
Task :app:mergeDebugNativeLibs FAILED
28 actionable tasks: 5 executed, 23 up-to-date
Note: D:\working-projects\TestProject\android\app\src\debug\java\com\testproject\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
java.io.IOException: Data error (cyclic redundancy check)
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 1m 25s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: D:\working-projects\TestProject\android\app\src\debug\java\com\testproject\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
java.io.IOException: Data error (cyclic redundancy check)
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 1m 25s
at makeError (D:\working-projects\TestProject\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at D:\working-projects\TestProject\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\working-projects\TestProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\working-projects\TestProject\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
Have been facing this issue all of a sudden
I have reinstalled the whole setup again for react native but still getting this same error. Getting no clues as to what is the exact issue.. All help appreciated..
I finally managed to get it working ... the issue was of bad sectors on HDD ... just ran chkdsk /f/r and everything started to work fine after its completion

Fail to run desktop app with desktop:run LIBGDX

I am using android studio idea for my libgdx project. I configured custom desktop configuration setting
Tasks: desktop:run
Gradle Project: mygame
Running android works fine but running this configuration brings the following error
9:08:42 PM: Executing task 'desktop:run'...
Executing tasks: [desktop:run]
Configuration on demand is an incubating feature. WARNING:
Configuration 'compile' is obsolete and has been replaced with
'implementation'. It will be removed at the end of 2018 Gradle now
uses separate output directories for each JVM language, but this build
assumes a single directory for all classes from a source set. This
behaviour has been deprecated and is scheduled to be removed in Gradle
5.0 at build_4irp102idy0ifcnkhwn53osnp$_run_closure3.doCall(D:\LibgdxProjects\Tembo\desktop\build.gradle:22)
(Run with --stacktrace to get the full stack trace of this
deprecation warning.)
FAILURE: Build failed with an exception.
What went wrong: java.lang.NullPointerException (no error message)
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 2s 9:08:45 PM: Task execution finished 'desktop:run'.
Important details
Gradle version: 4.4
How can i fix this. I tried downgrading my gradle version but the minimim supported is 4.4
NOTE: running gradlew desktop:run on project root works.
currently this version of gradle is not supported you can use version 2.3.3
There is an activity to upgrade to Gradle 4.6 which you can follow up here
https://github.com/libgdx/libgdx/issues/5177

Categories