dwickern / sbt-swagger-play

sbt plugin for swagger-play
MIT License
12 stars 2 forks source link

Compilation fails in multi-module project #9

Open gokhanoner opened 3 years ago

gokhanoner commented 3 years ago

Play version: 2.8.8

migrating from swagger-play. I have a multi-module project & not all sub-projects have application.conf file, but during compilation of one of those modules, I'm getting this

[error] Configuration error: Configuration error[application: application.conf: java.io.IOException: resource not found on classpath: application.conf, application.json: java.io.IOException: resource not found on classpath: application.json, application.properties: java.io.IOException: resource not found on classpath: application.properties]
[error]     at play.api.Configuration$.$anonfun$configError$1(Configuration.scala:157)
[error]     at scala.Option.map(Option.scala:242)
[error]     at play.api.Configuration$.configError(Configuration.scala:149)
[error]     at play.api.Configuration$.load(Configuration.scala:98)
[error]     at play.api.Configuration$.load(Configuration.scala:107)
[error]     at play.api.Configuration$.load(Configuration.scala:113)
[error]     at com.github.dwickern.swagger.SwaggerRunner$.run(SwaggerRunner.scala:23)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[error]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$12(SwaggerPlayPlugin.scala:87)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$$anon$2.run(SwaggerPlayPlugin.scala:172)
[error]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.withContextClassLoader(SwaggerPlayPlugin.scala:175)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$11(SwaggerPlayPlugin.scala:79)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]     at sbt.Execute.work(Execute.scala:291)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error]     at java.base/java.lang.Thread.run(Thread.java:831)
[error] Caused by: com.typesafe.config.ConfigException$IO: application: application.conf: java.io.IOException: resource not found on classpath: application.conf, application.json: java.io.IOException: resource not found on classpath: application.json, application.properties: java.io.IOException: resource not found on classpath: application.properties
[error]     at com.typesafe.config.impl.SimpleIncluder.fromBasename(SimpleIncluder.java:236)
[error]     at com.typesafe.config.impl.ConfigImpl.parseResourcesAnySyntax(ConfigImpl.java:133)
[error]     at com.typesafe.config.ConfigFactory.parseResourcesAnySyntax(ConfigFactory.java:1080)
[error]     at com.typesafe.config.DefaultConfigLoadingStrategy.parseApplicationConfig(DefaultConfigLoadingStrategy.java:36)
[error]     at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.java:529)
[error]     at play.api.Configuration$.$anonfun$load$6(Configuration.scala:74)
[error]     at scala.Option.getOrElse(Option.scala:201)
[error]     at play.api.Configuration$.load(Configuration.scala:70)
[error]     at play.api.Configuration$.load(Configuration.scala:107)
[error]     at play.api.Configuration$.load(Configuration.scala:113)
[error]     at com.github.dwickern.swagger.SwaggerRunner$.run(SwaggerRunner.scala:23)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[error]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$12(SwaggerPlayPlugin.scala:87)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$$anon$2.run(SwaggerPlayPlugin.scala:172)
[error]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.withContextClassLoader(SwaggerPlayPlugin.scala:175)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$11(SwaggerPlayPlugin.scala:79)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]     at sbt.Execute.work(Execute.scala:291)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error]     at java.base/java.lang.Thread.run(Thread.java:831)
[error] Caused by: com.typesafe.config.ConfigException$IO: application.conf: java.io.IOException: resource not found on classpath: application.conf
[error]     at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:190)
[error]     at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
[error]     at com.typesafe.config.impl.Parseable.parse(Parseable.java:152)
[error]     at com.typesafe.config.impl.SimpleIncluder.fromBasename(SimpleIncluder.java:185)
[error]     at com.typesafe.config.impl.ConfigImpl.parseResourcesAnySyntax(ConfigImpl.java:133)
[error]     at com.typesafe.config.ConfigFactory.parseResourcesAnySyntax(ConfigFactory.java:1080)
[error]     at com.typesafe.config.DefaultConfigLoadingStrategy.parseApplicationConfig(DefaultConfigLoadingStrategy.java:36)
[error]     at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.java:529)
[error]     at play.api.Configuration$.$anonfun$load$6(Configuration.scala:74)
[error]     at scala.Option.getOrElse(Option.scala:201)
[error]     at play.api.Configuration$.load(Configuration.scala:70)
[error]     at play.api.Configuration$.load(Configuration.scala:107)
[error]     at play.api.Configuration$.load(Configuration.scala:113)
[error]     at com.github.dwickern.swagger.SwaggerRunner$.run(SwaggerRunner.scala:23)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[error]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$12(SwaggerPlayPlugin.scala:87)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$$anon$2.run(SwaggerPlayPlugin.scala:172)
[error]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.withContextClassLoader(SwaggerPlayPlugin.scala:175)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$11(SwaggerPlayPlugin.scala:79)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]     at sbt.Execute.work(Execute.scala:291)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error]     at java.base/java.lang.Thread.run(Thread.java:831)
[error] Caused by: java.io.IOException: resource not found on classpath: application.conf
[error]     at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(Parseable.java:726)
[error]     at com.typesafe.config.impl.Parseable$ParseableResources.rawParseValue(Parseable.java:701)
[error]     at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:180)
[error]     at com.typesafe.config.impl.Parseable.parseValue(Parseable.java:174)
[error]     at com.typesafe.config.impl.Parseable.parse(Parseable.java:152)
[error]     at com.typesafe.config.impl.SimpleIncluder.fromBasename(SimpleIncluder.java:185)
[error]     at com.typesafe.config.impl.ConfigImpl.parseResourcesAnySyntax(ConfigImpl.java:133)
[error]     at com.typesafe.config.ConfigFactory.parseResourcesAnySyntax(ConfigFactory.java:1080)
[error]     at com.typesafe.config.DefaultConfigLoadingStrategy.parseApplicationConfig(DefaultConfigLoadingStrategy.java:36)
[error]     at com.typesafe.config.ConfigFactory.defaultApplication(ConfigFactory.java:529)
[error]     at play.api.Configuration$.$anonfun$load$6(Configuration.scala:74)
[error]     at scala.Option.getOrElse(Option.scala:201)
[error]     at play.api.Configuration$.load(Configuration.scala:70)
[error]     at play.api.Configuration$.load(Configuration.scala:107)
[error]     at play.api.Configuration$.load(Configuration.scala:113)
[error]     at com.github.dwickern.swagger.SwaggerRunner$.run(SwaggerRunner.scala:23)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[error]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$12(SwaggerPlayPlugin.scala:87)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$$anon$2.run(SwaggerPlayPlugin.scala:172)
[error]     at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.withContextClassLoader(SwaggerPlayPlugin.scala:175)
[error]     at com.github.dwickern.sbt.SwaggerPlayPlugin$.$anonfun$projectSettings$11(SwaggerPlayPlugin.scala:79)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]     at sbt.Execute.work(Execute.scala:291)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error]     at java.base/java.lang.Thread.run(Thread.java:831)
[error] (common / swaggerPlayJson) Configuration error: Configuration error[application: application.conf: java.io.IOException: resource not found on classpath: application.conf, application.json: java.io.IOException: resource not found on classpath: application.json, application.properties: java.io.IOException: resource not found on classpath: application.properties]
gokhanoner commented 3 years ago

Note: Adding an empty application.conf file solves the issue for now, but I believe it shouldn't be the case.

qomosoloto commented 2 years ago

Same problem...

dwickern commented 1 year ago

The SwaggerPlayPlugin should only be enabled for Play Framework projects: https://github.com/dwickern/sbt-swagger-play/blob/c1657330c02bc7669085d3052f50b0f6726fd21e/sbt-plugin/src/main/scala/com/github/dwickern/sbt/SwaggerPlayPlugin.scala#L18-L19

Are these Play projects without an application.conf, or is the plugin being enabled for non-Play projects somehow?