but classesDirs is a read-only object , and we got the below error
Could not run build action using connection to Gradle distribution ‘https://www.nexus.ford.com/repository/gradle-distributions/gradle-5.1-bin.zip’.
Build file ‘C:\Projects\Github\gesb-java-services\GlobalESTest\build.gradle’ line: 74
A problem occurred evaluating project ‘:GlobalESTest’.
Cannot set the value of read-only property ‘classesDirs’ for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.
so we are not sure how to proceed in resolving the above issue. Kindly guide us in resolving this issue.
May I ask why you should want to configure the main source set to have the same classes dirs as the test source set?
That would mean that test compilation and main compilation tasks write to the same directory and thus you would for example have overlapping output directories for those compilation tasks which is a very bad idea.
we have that line in Gradle 4.1 , because it places the compiled contents of src/main/java into the test classes build directory in order to make WELD initialize any classes that use CDI,
when we try to move to Gradle 5.x we are not sure what should be replaced for this line, because of that our Junits are failing with the following Exception
com.ford.it.exception.FordCdiException: The bean manager could not be configured.
at com.ford.it.cdi.CdiBeanManagerHelper.configureBeanManager(CdiBeanManagerHelper.java:130)
at com.ford.it.ftest.rule.FtestCdiPreparationRule.before(FtestCdiPreparationRule.java:42)
at com.ford.it.ftest.rule.FtestBaseRule$1.evaluate(FtestBaseRule.java:56)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at com.ford.it.ftest.rule.FtestBaseRule$1.evaluate(FtestBaseRule.java:62)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at com.ford.it.ftest.rule.FtestBaseRule$1.evaluate(FtestBaseRule.java:62)
at com.ford.it.ftest.rule.FtestBaseRule$1.evaluate(FtestBaseRule.java:62)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:61)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at jdk.internal.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy5.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118)
at jdk.internal.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.ford.it.exception.FordCdiException: Scan could not be invoked on cdi container and contexts could not be started.
at com.ford.it.cdi.CdiBeanManagerHelper.invokeScanAndStartContexts(CdiBeanManagerHelper.java:156)
at com.ford.it.cdi.CdiBeanManagerHelper.configureBeanManager(CdiBeanManagerHelper.java:120)
… 51 more
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001422: Enabled alternative com.ford.gesb.integration.common.internal.dao.gesb.GesbDAOTestConnectionManager in file:/C:/Projects/Github/gesb-java-services/GlobalESIntegTest/build/resources/test/META-INF/beans.xml@6 is not an alternative
at org.jboss.weld.bootstrap.Validator.validateEnabledAlternativeClasses(Validator.java:721)
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:392)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:85)
at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.validateBeans(ForwardingBootstrap.java:75)
at org.jboss.weld.environment.se.Weld.initialize(Weld.java:144)
at org.apache.deltaspike.cdise.weld.WeldContainerControl.boot(WeldContainerControl.java:68)
at com.ford.it.cdi.CdiBeanManagerHelper.invokeScanAndStartContexts(CdiBeanManagerHelper.java:148)
… 52 more
Unlikely.
I’m not a Gradle supporter or similar.
I’m a regular full-time employee of a totally different company and just a Gradle user helping other users.
And your problem does not sound like it is solved in 5 minutes in the real project.
That’s why I asked whether you could provide an MCVE demonstrating the situation.