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.
Related
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
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.
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?
I tried to run the hello-slick template from inside Typesafe Activator.
When it recompiled it produced:
Refreshing list of source files to watch for changes...
[info] Loading global plugins from C:\Users\Edward G Prentice\.sbt\plugins\project
[info] Loading global plugins from C:\Users\Edward G Prentice\.sbt\plugins
[info] Loading project definition from C:\Users\Edward G Prentice\hello-slick\project
[info] Set current project to hello-slick (in build file:/C:/Users/Edward%20G%20Prentice/hello-slick/)
[error] Expected '"'
[error] apply -cp "C:/Users/Edward
[error] ^
Failed to reload source file list: sbt process never got in touch, so unable to handle request WatchTransitiveSourcesRequest(true)
so clearly it is not expecting spaces in that portion of the classpath. I understand what's failing but not how to fix it.
...and what is the best channel to resolve problems with Typesafe Activator?
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