xpusostomos opened a new issue, #14267:
URL: https://github.com/apache/grails-core/issues/14267

   I'm porting a working application from grails4 to grails5.  I've already 
ported several other apps to grails5 (albeit, not ones that use views-json), so 
I'm fairly comfortable with the grails5 upgrade process. But in this particular 
app I upgraded the views-json plugin to 2.2.0. If I don't use "apply plugin", 
but just add the "implementation" to my dependencies, it works when running in 
Intellij idea. However, that doesn't work for production. So when I add the 
"apply plugin", I get this error on startup...
   
   ```
   2022-01-31 20:53:35.209  WARN --- [  restartedMain] 
org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext
 : Exception encountered during context initialization - cancelling refresh 
attempt: org.springframework.beans.factory.BeanCreationException: Error 
creating bean with name 
'org.springframework.boot.actuate.autoconfigure.metrics.task.TaskExecutorMetricsAutoConfiguration':
 Injection of autowired dependencies failed; nested exception is 
io.micronaut.context.exceptions.NonUniqueBeanException: Multiple possible bean 
candidates found: [java.util.concurrent.ExecutorService, 
java.util.concurrent.ExecutorService]
   Disconnected from the target VM, address: '127.0.0.1:50556', transport: 
'socket'
   2022-01-31 20:53:35.331  INFO --- [  restartedMain] 
org.apache.catalina.core.StandardService : Stopping service [Tomcat]
   2022-01-31 20:53:35.347  INFO --- [  restartedMain] 
org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener
 :
   
   Error starting ApplicationContext. To display the conditions report re-run 
your application with 'debug' enabled.
   2022-01-31 20:53:35.387 ERROR --- [  restartedMain] 
org.springframework.boot.SpringApplication : Application run failed
   
   org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 
'org.springframework.boot.actuate.autoconfigure.metrics.task.TaskExecutorMetricsAutoConfiguration':
 Injection of autowired dependencies failed; nested exception is 
io.micronaut.context.exceptions.NonUniqueBeanException: Multiple possible bean 
candidates found: [java.util.concurrent.ExecutorService, 
java.util.concurrent.ExecutorService]
   at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405)
   at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431)
   at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619)
   at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
   at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
   at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
   at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
   at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
   at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944)
   at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
   at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
   at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
   at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
   at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
   at grails.boot.GrailsApp.run(GrailsApp.groovy:99)
   at grails.boot.GrailsApp.run(GrailsApp.groovy:485)
   at grails.boot.GrailsApp.run(GrailsApp.groovy:472)
   at grails.boot.GrailsApp$run.call(Unknown Source)
   at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
   at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
   at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:148)
   at test.ng.Application.main(Application.groovy:16)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at 
org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
   Caused by: io.micronaut.context.exceptions.NonUniqueBeanException: Multiple 
possible bean candidates found: [java.util.concurrent.ExecutorService, 
java.util.concurrent.ExecutorService]
   at 
io.micronaut.context.DefaultBeanContext.findConcreteCandidate(DefaultBeanContext.java:2331)
   at 
io.micronaut.context.DefaultApplicationContext.findConcreteCandidate(DefaultApplicationContext.java:451)
   at 
io.micronaut.context.DefaultBeanContext.lastChanceResolve(DefaultBeanContext.java:3165)
   at 
io.micronaut.context.DefaultBeanContext.findConcreteCandidateNoCache(DefaultBeanContext.java:3052)
   at 
io.micronaut.context.DefaultBeanContext.findConcreteCandidate(DefaultBeanContext.java:2966)
   at 
io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2652)
   at 
io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:824)
   at 
io.micronaut.spring.context.factory.MicronautBeanFactory.doGetBean(MicronautBeanFactory.java:738)
   at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:283)
   at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
   at 
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
   at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.addCandidateEntry(DefaultListableBeanFactory.java:1598)
   at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1562)
   at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveMultipleBeans(DefaultListableBeanFactory.java:1481)
   at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1338)
   at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
   at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments(AutowiredAnnotationBeanPostProcessor.java:759)
   at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:719)
   at 
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
   at 
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
   ... 27 common frames omitted
   ```
   
   I can't make any sense of it, but it seems to be related to this plugin.
   
   If I use version 2.1.0 of the views-json plugin, I get the following error 
on startup....
   
   Task :fap:server:compileGsonViews FAILED
   Execution optimizations have been disabled for task 
':fap:server:compileGsonViews' to ensure correctness due to the following 
reasons:
     - Gradle detected a problem with the following location: 
'C:\Users\chris\GIT\ibis\fap\server\build\gson-classes\main'. Reason: Task 
':fap:server:bootWarMainClassName' uses this output of task 
':fap:server:compileGsonViews' without declaring an explicit or implicit 
dependency. This can lead to incorrect results being produced, depending on 
what order the tasks are executed. Please refer to 
https://docs.gradle.org/7.2/userguide/validation_problems.html#implicit_dependency
 for more details about this problem.
   
   FAILURE: Build failed with an exception.
   
   * What went wrong:
   Some problems were found with the configuration of task 
':fap:server:compileGsonViews' (type 'JsonViewCompilerTask').
     - In plugin 'org.grails.plugins.views-json' type 
'grails.views.gradle.json.JsonViewCompilerTask' property 
'compileOptions.encoding' is missing an input or output annotation.
   
       Reason: A property without annotation isn't considered during up-to-date 
checking.
   
       Possible solutions:
         1. Add an input or output annotation.
         2. Mark it as @Internal.
   
       Please refer to 
https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation
 for more details about this problem.
     - In plugin 'org.grails.plugins.views-json' type 
'grails.views.gradle.json.JsonViewCompilerTask' property 
'compileOptions.forkOptions' is missing an input or output annotation.
   
       Reason: A property without annotation isn't considered during up-to-date 
checking.
   
       Possible solutions:
         1. Add an input or output annotation.
         2. Mark it as @Internal.
   
       Please refer to 
https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation
 for more details about this problem.
     - In plugin 'org.grails.plugins.views-json' type 
'grails.views.gradle.json.JsonViewCompilerTask' property 'compilerName' is 
missing an input or output annotation.
   
       Reason: A property without annotation isn't considered during up-to-date 
checking.
   
       Possible solutions:
         1. Add an input or output annotation.
         2. Mark it as @Internal.
   
       Please refer to 
https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation
 for more details about this problem.
     - In plugin 'org.grails.plugins.views-json' type 
'grails.views.gradle.json.JsonViewCompilerTask' property 'fileExtension' is 
missing an input or output annotation.
   
       Reason: A property without annotation isn't considered during up-to-date 
checking.
   
       Possible solutions:
         1. Add an input or output annotation.
         2. Mark it as @Internal.
   
       Please refer to 
https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation
 for more details about this problem.
     - In plugin 'org.grails.plugins.views-json' type 
'grails.views.gradle.json.JsonViewCompilerTask' property 'scriptBaseName' is 
missing an input or output annotation.
   
       Reason: A property without annotation isn't considered during up-to-date 
checking.
   
       Possible solutions:
         1. Add an input or output annotation.
         2. Mark it as @Internal.
   
       Please refer to 
https://docs.gradle.org/7.2/userguide/validation_problems.html#missing_annotation
 for more details about this problem.
   
   
   And I can't use the 2.0.4 version of the plugin, I guess because it was 
configured for an  older gradle. Do you have any ideas?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to