Getting these errors while trying to build this repo/code? - gradle

Can Someone point me in the right direction about what this error is all about , as i'm fairly new to Java and all this building stuff.
the below Code is terminal output that is received after building
ubuntu#ip-172-31-43-23 ~/j/java-NFTB (develop)> ./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :protocol:compileJava
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/WalletGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/WalletExtensionGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/DatabaseGrpc.java:23: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/MonitorGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/nftbZksnarkGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/WalletSolidityGrpc.java:20: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
/home/ubuntu/java-nftb/java-NFTB/protocol/src/main/java/org/nftb/api/NetworkGrpc.java:23: error: cannot find symbol
#javax.annotation.Generated(
^
symbol: class Generated
location: package javax.annotation
7 errors
> Task :protocol:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':protocol:compileJava'.
Sorry, if i've made any mistakes please feel free to correct me as i am new to stackoverflow

You have to go to build.gradle file and make sure you have all the dependencies you need .
for example , here you are missing this
implementation 'javax.annotation:javax.annotation-api:1.2'
You can add and try to rebuild again , also please make sure to add the build.gradle code for next time .

Related

GitHub-action build error occurred Help me

Error building Maven due to GitHub action Help me.
this is error code
Error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project jts: Compilation failure: Compilation failure:
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/msg/service/impl/MsgServiceImpl.java:[10,44] package org.apache.catalina.tribes.transport does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/msg/service/impl/MsgServiceImpl.java:[11,29] package org.apache.commons.io does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/msg/service/MsgService.java:[6,45] package org.apache.xmlbeans.impl.xb.xsdschema does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/msg/web/MsgController.java:[12,29] package org.apache.commons.io does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/user/web/UserController.java:[14,29] package org.apache.commons.io does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/user/web/UserController.java:[27,21] package com.amazonaws does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/user/web/UserController.java:[28,33] package com.amazonaws.services.s3 does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/user/service/impl/UserServiceImpl.java:[13,26] package com.amazonaws.auth does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/user/service/impl/UserServiceImpl.java:[14,26] package com.amazonaws.auth does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/user/service/impl/UserServiceImpl.java:[15,26] package com.amazonaws.auth does not exist
Error: /home/runner/work/doingbe/doingbe/src/main/java/rnc/doingbe/biz/user/service/impl/UserServiceImpl.java:[16,33] package com.amazonaws.services.s3 does not exist
Error: s/service/impl/ProjectBulletinBoardServiceImpl.java:[7,29] package org.apache.commons.io does not exist
i try pom.xml add ${webapp.lib} path

Gradle Incremental Java build fails with “cannot find Symbol error”

Build is failing when I did a change in Java file
Android Gradle Plugin: 3.2.1
Gradle Version: 4.6
Please find the snapshot of error below:
17:58:31.131 [ERROR] [system.err] symbol: class FragmentNavigationManager
17:58:31.132 [ERROR] [system.err] location: package com.microsoft.office.officemobile.FragmentManagerInfra
17:58:31.138 [ERROR] [system.err] D:\Office\dev\officemobile\android\Java\src\com\microsoft\office\officemobile\ActionsTab\ActionsAdapter.java:45: error: cannot find symbol
17:58:31.138 [ERROR] [system.err] import com.microsoft.office.officemobile.KaizalaPhoneauth.KaizalaPhoneAuthManager;
I checked the undefined symbols are present inside file FragmentNavigationManager.java file inside the sources.
Using debug logs, I found the class file FragmentNavigationManager.class is getting deleted before doing java build
gradle: 17:58:28.630 [DEBUG] [org.gradle.api.internal.file.delete.Deleter] Deleting d:\office\build\droidarm\ship\officemobile\android\java\intermediates\javac\release\compileReleaseJavaWithJavac\classes\com\microsoft\office\officemobile\FragmentManagerInfra\FragmentNavigationManager.class
After deletion of above class, while doing Java incremental build, FragmentNavigationManager.java should be passed as an input for javac, but it is not happening, which is causing undefined symbol issue. Clean build working fine
I found the issue
The source file path is: src\com\microsoft\office\officemobilefragmentmanagerinfra\FragmentNavigationManager.java
Generated Class file: intermediates\javac\release\compileReleaseJavaWithJavac\classes\com\microsoft\office\officemobileFragmentManagerInfra\FragmentNavigationManager.class
There is a case mismatch in directory name at source path and generated class path, which is causing the issue. Source path has fragmentnavigationmanager instead of FragmentNavigationManager
I found that the package name is: com.microsoft.office.officemobile.FragmentManagerInfra.FragmentNavigationManager. Changing directory name to match the package name at the source path resolves the issue
Is this expected, as full build is working fine and incremental Gradle build is only failing?
Working on Windows 10

Gradle Test Fails in CircleCI- Could not find symbols for Lombok Generated Code

I have a Spring Boot application with Gradle. I tried upgrading to Spring Boot 2.1.0.RELEASE. I also had to upgrade Gradel Wrapper in gradle-wrapper.properties like this:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
My code uses Lombok 1.18.2
Locally, my application tests runs correctly. However, CircleCI build fails, like this.
!/bin/bash -eo pipefail
gradle test
Task :compileJava
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:31: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:34: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:37: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:40: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:43: error: cannot find symbol
categoryRepository.save(Category.builder()
^
symbol: method builder()
location: class Category
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:48: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:52: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:56: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:60: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
/home/circleci/repo/src/main/java/guru/springframework/spring5webfluxrest/bootstrap/Bootstrap.java:64: error: cannot find symbol
vendorRepository.save(Vendor.builder()
^
symbol: method builder()
location: class Vendor
10 errors
Task :compileJava FAILED
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 3s
1 actionable task: 1 executed
Exited with code 1
Please help.
Try change gradle and use ./gradlew under the steps: section in the config.yml as the template below:
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/repo
environment:
# Customize the JVM maximum heap limit
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: ./gradlew dependencies # <-- changed from `gradle dependencies`
- save_cache:
paths:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle" }}
# run tests!
- run: ./gradlew test # <-- changed from `gradle test`
What worked for me was add "annotationProcessor" to build.gradle dependencies (it was not building locally either).
dependencies {
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
}
Use annotationProcessor 'org.projectlombok:lombok' in build.gradle in dependencies. It will work smooth.

Converting maven to gradle of Spring Initializr

Spring Initializr is a open source project , which can be downloaded/cloned from github to run our own spring initializr. however the build of the project is maven. I want to convert it to gradle. Can anyone Help ?
I tried it with gradle init and gradle build
Gradle init is creating build.gradle and settings.gradle but gradle build is giving error.
Can someone try and post the solution
Thanks in advance
Error Details :
Task :initializr-actuator:compileTestJava FAILED
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\ActuatorIntegrationTests.java:19: error: package io.spring.initializr.web does not exist
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\ActuatorIntegrationTests.java:35: error: cannot find symbol
extends AbstractFullStackInitializrIntegrationTests {
^
symbol: class AbstractFullStackInitializrIntegrationTests
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\info\BomRangesInfoContributorTests.java:24: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\metric\ProjectGenerationMetricsListenerTests.java:28: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\AbstractInitializrStatTests.java:23: error: package io.spring.initializr.test.metadata does not exist
import io.spring.initializr.test.metadata.InitializrMetadataTestBuilder;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\MainControllerStatsIntegrationTests.java:24: error: package io.spring.initializr.web does not exist
import io.spring.initializr.web.AbstractFullStackInitializrIntegrationTests;
^
D:\Duplicate1\initializr\initializr-actuator\src\test\java\io\spring\initializr\actuate\stat\MainControllerStatsIntegrationTests.java:56: error: cannot find symbol
extends AbstractFullStackInitializrIntegrationTests {
^
symbol: class AbstractFullStackInitializrIntegrationTests
7 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':initializr-actuator:compileTestJava'.
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 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
11 actionable tasks: 1 executed, 10 up-to-date
Instead of converting that you can generate fresh project from following url:
https://start.spring.io/
Select Gradle Project and download the code.

Where did the 2nd level of maven java compiler error information go when I updated to java7?

When using java6 I saw two levels of error information
The error: file:[line,char] error: cannot find symbol
Details: symbol: method .... location: class com.....
Now, that I updated to java7 I no longer have this information. If I compile manually using "-Xlint:all" I see the details. For some reason maven isn't displaying the details.
Please let me know if you have any ideas how to fix this.
Thanks
Peter
Good using Java 6
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] warntest/src/main/java/com/attivio/foo/App.java:[9,1] cannot find symbol
symbol : class DoesNotExistType
location: class com.foo.App
Less Information using Java 7
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] warntest/src/main/java/com/attivio/foo/App.java:[9,1] error: cannot find symbol
[INFO] 1 error
This is a known issue: http://jira.codehaus.org/browse/MCOMPILER-158

Resources