Closed Coobik closed 5 years ago
Perhaps you could try the following?
task myTest(dependsOn: testClasses, type: Test, group: 'verification') {
com.github.maiflai.ScalaTestPlugin.configure(it, new com.github.maiflai.BackwardsCompatibleJavaExecActionFactory())
tags {
include 'com.example.tags.MyTag'
}
}
Hi! i've tried com.github.maiflai.ScalaTestPlugin.configure but this resulted in null pointer exception in gradle: in ExecuteActionsTaskExecuter.execute:95 (gradle 5.1.1) maybe "it" null
Please can you share the full project, or a cut-down example that fails, or even just the full stack trace?
Thanks, Stu
in gradle.properties: com.github.maiflai.gradle-scalatest.mode=append
in build.gradle:
task myTest(dependsOn: testClasses, type: Test, group: 'verification') {
com.github.maiflai.ScalaTestPlugin.configure(it, new com.github.maiflai.BackwardsCompatibleJavaExecActionFactory())
tags {
include 'com.example.tags.MyTag'
}
}
tag annotation:
@TagAnnotation
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface MyTag {
}
stack trace:
Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':myTest'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:95) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:119) at org.gradle.api.internal.tasks.execution.ResolvePreviousStateExecuter.execute(ResolvePreviousStateExecuter.java:43) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:93) at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:45) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:94) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:56) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:55) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:67) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315) at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305) at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101) at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36) at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49) at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336) at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193) at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) Caused by: java.lang.NullPointerException
Thanks. Which version of Gradle are you using? I still can't reproduce this on macOS.
From the stacktrace it looks to be an internal Gradle problem while trying to determine the task outputs. Do you have a custom buildDir or other things happening?
A minimal project that reproduces the issue would be incredibly valuable here.
Hi! nothing custom. gradle 5.1.1 tuesday.zip
Sorry, this is my mistake.
The line to add should be
com.github.maiflai.ScalaTestPlugin.configure(it, new com.github.maiflai.BackwardsCompatibleJavaExecActionFactory(it.project.gradle.gradleVersion))
I plan to remove this in the next version of the plugin, but can you verify that it helps at the moment?
Thanks, Stu.
hi!
com.github.maiflai.ScalaTestPlugin.configure(it, new com.github.maiflai.BackwardsCompatibleJavaExecActionFactory(it.project.gradle.gradleVersion))
did the trick thanks! could you please also update readme
I have the same issue mentioned in the beginning (Could not find method tags() for
).
It seems that BackwardsCompatibleJavaExecActionFactory.groovy is not in the latest commit anymore. This is the commit that it's being added https://github.com/maiflai/gradle-scalatest/commit/1c9a3fc840df2b248126f28d391ee4368e039aa6.
My Gradle version is 6.4.1
Hi! Looks like filtering by tags only works with com.github.maiflai.gradle-scalatest.mode=replaceAll in build.gradle, we create a task like this (the only way I could get it to work!):
then running ./gradlew myTest we get the tagged tests to run
But if i set com.github.maiflai.gradle-scalatest.mode=append Gradle reports an error: Could not find method tags() for arguments [...] on task ':myTest' of type org.gradle.api.tasks.testing.Test
I want to be able to run the new ScalaTest tests with ./gradlew scalatest (the project already has legacy specs2 tests)
How can I make filtering by tags work in append mode? What should I do? Thanks!