Gradle 3.5 Java-Library plugin with IDEA and Weld/CDI problem


(Seto) #1

I’m not sure it’s a bug of Gradle, IDEA or my code.

module blueeyes-shared

public abstract class AbstractRetrofitServiceProducer

module blueeyes-server

@ApplicationScoped
public class RetrofitServiceProducer extends AbstractRetrofitServiceProducer {
@Produces
@Override
public RetrofitService getRetrofitService() {
return super.getRetrofitService();
}
}

module dimensionstory-server

@ApplicationScoped
public class DimensionStoryRetrofitServiceProducer extends AbstractRetrofitServiceProducer {
@Produces
@Override
public DimensionStoryRetrofitService getRetrofitService() {
return super.getRetrofitService();
}
}

Dependencies:
blueeyes-sever-api

api project(":blueeyes-shared")

blueeyes-server-internal-api

api project(':blueeyes-server-api')

blueeyes-server

 implementation project(":blueeyes-server-internal-api")
 implementation project(":blueeyes-client")

dimensionstory-shared

api project(':blueeyes-shared')

dimensionstory-server

 implementation project(':blueeyes-server-api')
 runtimeOnly project(':blueeyes-server')
 implementation project(':dimensionstory-shared')

When running the dimensionstory-server, it will report the exception below.

Exception in thread “main” org.jboss.weld.exceptions.DeploymentException: Exception List with 3 exceptions:
Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type RetrofitService with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject co.kaiba.blueeyes.dimensionstory.impl.data.SocialAPI$AddGroupTask.retrofitService
at co.kaiba.blueeyes.dimensionstory.impl.data.SocialAPI$AddGroupTask.retrofitService(AddGroupTask.java:0)

at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:375)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:63)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:61)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Exception 1 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type DimensionStoryRetrofitService with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject private co.kaiba.blueeyes.dimensionstory.impl.data.StoryAPI.dimensionStoryRetrofitService
at co.kaiba.blueeyes.dimensionstory.impl.data.StoryAPI.dimensionStoryRetrofitService(StoryAPI.java:0)

at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:375)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:63)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:61)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Exception 2 :
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type RetrofitService with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject co.kaiba.blueeyes.dimensionstory.impl.data.SocialAPI$AddUserTask.retrofitService
at co.kaiba.blueeyes.dimensionstory.impl.data.SocialAPI$AddUserTask.retrofitService(AddUserTask.java:0)

at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:375)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:63)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:61)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

at org.jboss.weld.bootstrap.ConcurrentValidator.validateBeans(ConcurrentValidator.java:71)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:481)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:771)
at org.apache.deltaspike.cdise.weld.WeldContainerControl.boot(WeldContainerControl.java:72)
at co.kaiba.blueeyes.impl.kernel.Kernel.main(Kernel.java:55)

And “api project(’:dimensionstory-shared’)” doesn’t work as well.

  • If I change the “implementation project(’:dimensionstory-shared’)” in dimensionstory-server to “compile project(’:dimensionstory-shared’)”, it runs well.
  • if I change the “runtimeOnly project(’:blueeyes-server’)” in dimensionstory-server to “compile project(’:blueeyes-server’)”, it runs well.
  • If I add the “compile project(’:blueeyes-shared’)” to dimensionstory-server, it runs well.

And the blueeyes-server uses the Retroservice produces by RetrofitServiceProducer as well, but run it separately with no exception.


(Seto) #2

But from the doc, it says compile is deprecated. I should always use the new words.
But I tried every new word, none works.


(Seto) #3

It seems that it’s a bug of IDEA. I tried application plugin with run task. It runs well.


(Seto) #4

I created an issue for IDEA here. Please check whether it’s a bug of Gradle or IDEA.
https://youtrack.jetbrains.com/issue/IDEA-173028