Closed breandan closed 6 years ago
@breandan why do you need the kotlin-dsl
plugin? It is intended to be used in build logic projects such as buildSrc
or a build for a Gradle plugin. See https://docs.gradle.org/5.0-rc-1/userguide/kotlin_dsl.html#sec:kotlin-dsl_plugin It is not required at all to use Gradle Kotlin DSL build scripts in your build.
To clarify, it is not needed for this project, but I would still like to use it for another project, where buildSrc
is being used.
@breandan in a build with a buildSrc
it makes sense to apply the kotlin-dsl
plugin in buildSrc
. But unless that project is building a Gradle plugin it doesn't make sense to apply the kotlin-dsl
plugin to your projects.
In other words, in that project, keep it in buildSrc
:
https://github.com/duckietown/hatchery/blob/3c2ffc2129b137a50c180f038fead4ebc8c7b6b6/buildSrc/build.gradle.kts#L1-L3
and remove it from:
https://github.com/duckietown/hatchery/blob/3c2ffc2129b137a50c180f038fead4ebc8c7b6b6/build.gradle.kts#L33
Makes sense, thanks Paul!
On Thu, Nov 8, 2018 at 11:36 AM Paul Merlin notifications@github.com wrote:
@breandan https://github.com/breandan in a build with a buildSrc it makes sense to apply the kotlin-dsl plugin in buildSrc. But unless that project is building a Gradle plugin it doesn't make sense to apply the kotlin-dsl plugin to your projects.
In other words, in that project, keep it in buildSrc:
https://github.com/duckietown/hatchery/blob/3c2ffc2129b137a50c180f038fead4ebc8c7b6b6/buildSrc/build.gradle.kts#L1-L3 and remove it from:
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gradle/kotlin-dsl/issues/1242#issuecomment-437062512, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKuZFeYRRZRLEgbYZFonk8zkINIuviaks5utF10gaJpZM4YUp6W .
After removing the kotlin-dsl
plugin from the project's build.gradle.kts
(but keeping it in buildSrc/build.gradle.kts
as suggested), I am still receiving the same error when I run ./gradlew test
. Can you see anything else out of the ordinary that might be causing it to fail?
java.lang.NoSuchMethodError: org.apache.log4j.WriterAppender.<init>(Lorg/apache/log4j/Layout;Ljava/io/Writer;)V
at com.intellij.testFramework.TestLoggerFactory.<clinit>(TestLoggerFactory.java:165)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.intellij.openapi.diagnostic.Logger.setFactory(Logger.java:44)
at com.intellij.testFramework.UsefulTestCase.<clinit>(UsefulTestCase.java:73)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at junit.framework.TestSuite.createTest(TestSuite.java:131)
at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
at junit.framework.TestSuite.<init>(TestSuite.java:75)
at org.junit.internal.runners.JUnit38ClassRunner.<init>(JUnit38ClassRunner.java:74)
at org.junit.internal.builders.JUnit3Builder.runnerForClass(JUnit3Builder.java:11)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:78)
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:66)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
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.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.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:118)
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.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.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
This is my buildscript. When I running
./gradlew test
on this project, I receive the following error:According to JetBrains/gradle-intellij-plugin#335, this is beacuse I am using the
kotlin-dsl
plugin, which interferes with the test classpath. After removing the plugin,./gradlew test
succeeds. Why does this plugin modify my test classpath and how can I keep using it and still run tests?cc: @zolotov