run gradle take a long time and still going - java

I am currently making a discord bot using Gradle and JDA in Intellij. However, when I tried to run the Gradle - It has been 10 minutes and still going of running the Gradle and it stuck. I tried to clear the cache, close and open the project, and re-build the gradle; I am still stuck at this position
12:11:56 PM: Executing task 'run --stacktrace'...
Starting Gradle Daemon...
Gradle Daemon started in 3 s 230 ms
> Task :compileJava
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.
> Task :processResources
> Task :classes
> Task :run
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'org.apache.logging.log4j.simplelog.StatusLogger.level' to TRACE to show Log4j2 internal initialization logging.
Started nijibase with version 1.9.17
STARTING SHARD 0
Where did I go wrong? I don't know what else should I put since the stacktrace hasn't showed me where did I go wrong

Related

Intellij idea error when checking hyperskill project

I am currently working on Hyperskill (JetBrains academy) on Java Backend Developer track. Every project that I try to check from the Intellij Idea IDE gives me this error:
Failed to launch checking
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':Simple_Search_Engine-task:compileTestJava'.
Could not resolve all files for configuration ':Simple_Search_Engine-task:testCompileClasspath'.
Could not find com.github.hyperskill:hs-test:release-SNAPSHOT.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/github/hyperskill/hs-test/release-SNAPSHOT/maven-metadata.xml
- https://repo.maven.apache.org/maven2/com/github/hyperskill/hs-test/release-SNAPSHOT/hs-test-release-SNAPSHOT.pom
- https://jitpack.io/com/github/hyperskill/hs-test/release-SNAPSHOT/maven-metadata.xml
- https://jitpack.io/com/github/hyperskill/hs-test/release-SNAPSHOT/hs-test-release-v8-g6845035-132.pom
Required by:
project :Simple_Search_Engine-task
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 3s
Task :Simple_Search_Engine-task:compileJava UP-TO-DATE
Task :Simple_Search_Engine-task:processResources NO-SOURCE
Task :Simple_Search_Engine-task:classes UP-TO-DATE
Task :util:compileJava NO-SOURCE
Task :util:processResources NO-SOURCE
Task :util:classes UP-TO-DATE
Task :util:compileTestJava NO-SOURCE
Task :util:processTestResources NO-SOURCE
Task :util:testClasses UP-TO-DATE
Task :Simple_Search_Engine-task:compileTestJava FAILED
2 actionable tasks: 1 executed, 1 up-to-date
My project: https://drive.google.com/drive/folders/1xEV47YXdkVRUfB0JPSEkmcPtBbb5rbvJ?usp=sharing
Project from hyperskill: https://hyperskill.org/projects/66?track=12
I tried reinstalling the IDE or changing the project that I am working but the same errors. When I am uploading the solve directly on hyperskill website it works perfectly fine.
Here is also a video if it is more helpful: https://youtu.be/nvrpHuVq44A
Please help me! :D
Go to the build.gradle file for this project and replace the following line:
'com.github.hyperskill:hs-test:release-SNAPSHOT'
With
'com.github.hyperskill:hs-test:master-SNAPSHOT'
It seems that the release branch has an error, so change it to master.
Then, open up IntelliJ and restart Gradle.
Could you please select JDK 17 as Gradle JVM in Settings/Preferences | Build, Execution, Deployment | Build Tools | Gradle?
After that, please ensure that JDK 17 is selected as Project SDK in File | Project Structure.

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

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.

libGDX Error FAILURE: Build failed with an exception

This is the error I get from the console of the program and it won't let me even import the gradle to Eclipse
Generating app in C:\Users\mrgnh\Desktop\libGDXstuff
Executing 'C:\Users\mrgnh\Desktop\libGDXstuff/gradlew.bat clean --no-daemon'
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: https://docs.gradle.org/6.7.1/userguide/gradle_daemon.html.
Daemon will be stopped at the end of the build stopping after processing
FAILURE: Build failed with an exception.
Where:
Settings file 'C:\Users\mrgnh\Desktop\libGDXstuff\settings.gradle'
What went wrong:
Could not compile settings file 'C:\Users\mrgnh\Desktop\libGDXstuff\settings.gradle'.
startup failed:
General error during semantic analysis: Unsupported class file major version 60
It turns out I am blind and that libGDX does not support JDK 16 only 8-15
So when creating the gradle with the JDK 16 gradle System it wasn't working out
Try to change to latest gradle website version of gradle in file: Gradle -> Wrapper -> gradle-wrapper.properties
It helped me.

Gradle task failing on GitLab CI main method not found

I'm in the process of setting up a new GitLab CI pipeline for a project.
As a start, my goal is to create a basic pipeline that builds, tests and analyzes the project (3 simple stages).
My problem is that, that my second stage (test) depends on a Gradle task that generates a bit of documentation (we generated on the fly documentation based on tests). Said task invokes the main of a utility to generate a simple piece of documentation.
While all tasks work fine when I run them under a Windows host, doing the same on GitLab's CI using an Alpine Linux based image fails with the following error:
> Task :compileTestJava
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.
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test
> Task :generatePermissionsDocument FAILED
Error: Could not find or load main class
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generatePermissionsDocument'.
> Process 'command '/opt/java/openjdk/bin/java'' finished with non-zero exit value 1
I have tried enabling Gradle stacktraces but I did not manage to get any good information out of them. For the most part both my build script and the GitLab CI script look OK (included below for reference):
image: adoptopenjdk/openjdk8:jdk8u222-b10-alpine
include:
- project: "devops/ci-templates"
ref: "master"
file: "sonar/sonar-gradle.yml"
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- apk add --no-cache tzdata
- cp /usr/share/zoneinfo/America/New_York /etc/localtime
- echo "America/New_York" > /etc/timezone
stages:
- build
- test
- analysis
build:
stage: build
script: ./gradlew --build-cache clean assemble -PMARKETING_SKIP_INT_TESTS
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- build
- .gradle
- src/main/java/fts/marketing/util/Version.java
retry: 2
only:
- merge_requests
- master
- /^support\/\d+[.]\d+$/
- tags
except:
- api
test:
stage: test
script: ./gradlew test -PMARKETING_SKIP_INT_TESTS --stacktrace
cache:
key: "$CI_COMMIT_REF_NAME"
policy: pull
paths:
- build
- .gradle
- src/main/java/fts/marketing/util/Version.java
only:
- merge_requests
- master
- /^support\/\d+[.]\d+$/
- tags
except:
- api
Initially I though that the this would be a caching or permission related problem, but I checked both the integrity or the cache produced by the build task as well as the permissions of the generated folder and everything looks fine.
For reference the task I'm trying to invoke is this one:
task generatePermissionsDocument(type: JavaExec, group: 'application') {
description = 'Will generate API Permissions adoc'
main = 'fts.marketing.tools.GeneratePermissionsDocument'
classpath = sourceSets.main.runtimeClasspath
//jvmArgs = applicationDefaultJvmArgs
workingDir = generatedDocumentation
}
Can anyone shed some light as to why this is failing and what must be done to resolve it?
I managed to find out the root cases of this. I was doing some conditional setting of the application's default JVM args which apparently was wrong. Said process was including a trailing ',' in the args passed in by Gradle to the JVM.
For some reason this was not well liked when running from a Unix like environment, whereas it was working fine on Windows hosts. I re-worked the conditional part of the arg setting and everything worked like a charm.

jenkins finished success while the make command failure

I used jenkins to build android image nightly, and then found even the make and cp command failure,the jenkins still finished success.
The last build setup is to copy log file to job directory, so maybe it succeed,and then jenkins finished SUCCESS.
And the Text-finder plugin can only set build unstable not failure, so how to make the build failure when make fails.
The log is like this:
make: \*** No rule to make target \`device/vendor/product/google_frameworks/Google_Play.apk', needed by `out/target/product/device/system/app/Google_Play.apk'. Stop.
make: *** Waiting for unfinished jobs....
target R.java/Manifest.java: FileBrowser(out/target/common/obj/APPS/FileBrowser_intermediates/src/R.stamp)
Warning: AndroidManifest.xml already defines versionCode (in http://schemas.android.com/apk/res/android); using existing value in manifest. untranslatable but exists in locale 'zh_CN'
aapt: warning: string 'pref_development_uastring' has no default translation in packages/apps/Browser/res; found: zh_CN zh_TW
Note: Recompile with -Xlint:unchecked for details.
======================>End<=======================
cp: cannot stat `/home/jenkins/job_name/source/out/target/product/device/package.img': No such file or directory
Extended Email Publisher is currently disabled in project settings
Finished: SUCCESS
The Jenkins job is marked as successfull if the last command of the script has succeed.
A simple workaround is to specify set -e at the begginning of your bash script.
-e Exit immediately if a command exits with a non-zero status.
You can also specify a trap: trap 'exit 1' ERR, to stop the script if an error occurs.

Categories