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
Related
I want to create a simple "news api" in scala-play where the server stub is generated with the openapi scala-play-server generator. (Therefore i use this https://drive.google.com/file/d/1Qez3JcdaBPNVq1BAWrgcS_sbyDrxAQKM/view?usp=sharing openapi file)
The following command is used to generate the project:
openapi-generator generate -g scala-play-server --additional-properties=basePackage=de.hwrBerlin.lehre.effort.newsapi,apiPackage=de.hwrBerlin.lehre.effort.newsapi.generated.api,modelPackage=de.hwrBerlin.lehre.effort.newsapi.generated.model -o api -i openapi.yaml
But when i start to run the project with sbt run and then open localhost:9000 i get several errors:
[info] Compiling 14 Scala sources and 2 Java sources to D:\Programmieren\Effort\newsapi\api\target\scala-2.12\classes ...
[error] D:\Programmieren\Effort\newsapi\api\app\de\hwrBerlin\lehre\effort\newsapi\ErrorHandler.scala:3:28: not found: type DefaultHttpErrorHandler
[error] class ErrorHandler extends DefaultHttpErrorHandler {
[error] ^
[error] D:\Programmieren\Effort\newsapi\api\app\de\hwrBerlin\lehre\effort\newsapi\ErrorHandler.scala:5:47: not found: type Future
[error] e: Throwable): Future[Result] = e match {
...
[error] D:\Programmieren\Effort\newsapi\api\app\de\hwrBerlin\lehre\effort\newsapi\generated\model\News.scala:21:54: not found: value Json
[error] implicit lazy val newsJsonFormat: Format[News] = Json.format[News]
[error] ^
[error] 49 errors found
[error] (Compile / compileIncremental) Compilation failed
[error] application -
(for full stack trace look here https://drive.google.com/file/d/16bdEtOROIGPUIMJvabn3lR4UCnUO4j6V/view?usp=sharing)
It seems like a many issues are missing but i have no idea how to fix the issue except doing it manually.
I use windows 10 and the AdoptOpenJDK version "11.0.8"
This issue is a bug in the current openapi-generator version (4.y.z).
I opened an issue on github:
https://github.com/OpenAPITools/openapi-generator/issues/7371
and wing328(Core team and founding member of OpenAPI Generator) suggested using the 5.0.0-beta2 of the openapi-generator. This fixed all import and dependency issues.
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.
I'm trying to build a kjar from our existing drools project with lots of individual rules file.
To speed up deployment I would like to generate the model into the kjar as introduced with Drools 7.7.0.Final.
The command I use is: mvn clean install -DgenerateModel=WITHDRL -X
Pretty soon I get an error message:
[ERROR] Failed to execute goal org.kie:kie-maven-plugin:7.7.0.Final:generateModel (default-generateModel) on project foobar: Execution default-generateModel of goal org.kie:kie-maven-plugin:7.7.0.Final:generateModel failed: (line 1,col 33) Parse error. Found ",", expected one of "%=" "&=" "*=" "++" "+=" "--" "-=" "/=" ";" "<<=" "=" ">>=" ">>>=" "^=" "|="
[ERROR] Problem stacktrace :
[ERROR] org.drools.javaparser.GeneratedJavaParser.generateParseException(GeneratedJavaParser.java:11460)
There is no information in which file this error occured. Since our project contains >300 DRL Files it is a bit hard to find the culprit.
Is there any way to get more information out of the Drools Maven Plugin on which file is causing the issue?
That's bug of kie-maven-plugin.
There are the bug's JIRA below.
DROOLS-3505
DROOLS-3523
If dialect is java and your rules have connect expressions with "comma" inside a modify block, The workaround is that
property inside modify block one by one.
the other workaround is changing dialect to mvel.
But, you have to write 'dialect "mvel"' in each rule file.
because dialect species isn't shared in package.
I have maven-checkstyle-plugin(v2.5) and maven-eclipse-plugin(v2.8) configured.
Everything worked as expected but as soon as I introduced,
module name="SuppressWarningsHolder" AND/OR module name="SuppressWarningsFilter" to my checkstyle-config.xml, I started to have problems building the project.
Here is what I get:
[ERROR] BUILD ERROR
1> [INFO] ------------------------------------------------------------------------
1> [INFO] Failed during checkstyle configuration
1>
1>EXEC : Embedded error : cannot initialize module TreeWalker - Unable to instantiate SuppressWarningsHolder
1> Unable to instantiate SuppressWarningsHolderCheck
If I remove SuppressWarningsHolderCheck, I get the same error for SuppressWarningsFilter.
Any ideas?
Thanks
It appears you have two problems:
You are using maven-checkstyle-plugin v2.5, which is based on Checkstyle 5.0. In Checkstyle 5.0, the SuppressWarningsHolderCheck and the SuppressWarningsFilter did not exist yet, as they were introduced in 5.7. So you must first upgrade your maven-checkstyle-plugin.
The SuppressWarningsFilter must be configured directly under Checker, not under TreeWalker. The documentation does not make that part very explicit, although it is there. Note that the SuppressWarningsHolder does go under TreeWalker.
If you do both things, stuff should hopefully start working.
Followed is my project structure.
com.company.univ.scheduler.api
--src
----com
-----company
-------univ
--------scheduler
----------api
------------annotation
---Column.java
---Id.java
---pom.xml
-------------model
----App.java
----job.java
----Task.java
----pom.xml
-------------service
----LockService.java
----ResultService.java
----TaskService.java
----pom.xml
Under model folder,the App.java will have to import annotation's java file.
Like
import com.company.univ.scheduler.api.Column;
import com.company.univ.scheduler.api.Id;
Likewise,all files distributed under various folder would be related.How would maven pom.xml handle this issue?
P.S When do maven compile,there always show error message like"can not find symbol;"
"method can not be override"..... I have checked those java files to the target line but no that obvious errors likely to happen,As our project was build in Ant before and all fine.
The maven compile info:
[ERROR] COMPILATION ERROR :
[INFO]-------------------------------------------------------
[ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[7,50] package com.company.univ.scheduler.api doesnt exist
[ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[8,50] package com.company.univ.scheduler.api doesnt exist [ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[26,2] can not find symbol
symbol:class Column
location:class com.company.univ.scheduler.api.model.task
[ERROR] ..\com.company.univ.scheduler.api\src\com\company\univ\scheduler\api\model\Task.java:[22,2] can not find symbol
symbol:class Id
location:class com.company.univ.scheduler.api.model.task
Java source should be in src/main/java, which is the root of your package hierarchy.
I would strongly urge you to use the standard Maven directory layout.
Why are there pom files in each of your packages?