Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use moduleOptions extension in custom test task #122

Open
mizosoft opened this issue Oct 14, 2019 · 3 comments
Open

Can't use moduleOptions extension in custom test task #122

mizosoft opened this issue Oct 14, 2019 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mizosoft
Copy link

mizosoft commented Oct 14, 2019

I'm having trouble running a custom test task on the classpath. The custom task is used to enable TestNG, which only a portion of the tests use. This is the relevant portion of my build file:

test {
  moduleOptions { // Ok
    runOnClasspath = true
  }

  useJUnitPlatform()
  testLogging {
    events = ['skipped', 'failed']
    showStandardStreams = true
  }
}

task tckTests(type: Test) {
  moduleOptions { // Causes problems
    runOnClasspath = true
  }

  useTestNG()
  testLogging {
    events = ['skipped', 'failed']
    showStandardStreams = true
  }
  mustRunAfter(':test')
}

Error:

Could not find method moduleOptions() for arguments [build_d4flzour41wmm2m64le5sxrq5$_run_closure4$_closure7@1825ba81] on task ':tckTests' of type org.gradle.api.tasks.testing.Test.

It also doesn't work when I instead try to configure tasks with type Test:

tasks.withType(Test) {
  moduleOptions {
    runOnClasspath = true
  }

  testLogging {
    events = ['skipped', 'failed']
    showStandardStreams = true
  }
}

Am I doing anything wrong or this is a limitation in the plugin ?

@mizosoft
Copy link
Author

I'm using Gradle 5.5 and this is how I apply the plugin:

buildscript {
  repositories {
    gradlePluginPortal()
  }

  dependencies {
    classpath 'org.javamodularity:moduleplugin:1.6.0'
  }
}

...

apply plugin: "org.javamodularity.moduleplugin"

@tlinkowski
Copy link
Collaborator

Hi Moataz, unfortunately this is not yet supported by this plugin.

Related to #77.

@tlinkowski tlinkowski added the enhancement New feature or request label Oct 16, 2019
@big-andy-coates
Copy link
Collaborator

Also related to #103, which is asking for support for custom compilation tasks.

Happy to accept a PR.

@big-andy-coates big-andy-coates added the help wanted Extra attention is needed label Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants