codeql-action: Module Gradle/Java/CodeQL build fails due to "Unknown javac parameter: --add-opens"

I have Gradle Java projects that I’d love to use CodeQL to analyse. However, if I enable CodeQL either in its own workflow or integrated into the main build workflow, then the build fails with error:

Error: Exception in thread "main" Unknown javac parameter: --add-opens
	at com.semmle.extractor.java.args.JavaExtractorArgs.parse(JavaExtractorArgs.java:331)
	at com.semmle.extractor.java.JavaExtractor.<init>(JavaExtractor.java:187)
	at com.semmle.extractor.java.JavaExtractor.main(JavaExtractor.java:482)

The --add-opens command line option is being introduced by the org.javamodularity.moduleplugin Gradle plugin, which the project is using as its using Java’s module system (a.k.a. Jigsaw).

However, its not javac that’s complaining about the option, but com.semmle.extractor.java.args.JavaExtractorArgs.parse. The version of java the project is using supports the option. Looks like this could be an issue with the LGTM code…?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I’ll also note that even with the above, you won’t get 2.9.1 just yet because we haven’t yet bumped latest to point to 2.9.1 as it is very new. That’s due to happen on Monday, or Tuesday at the latest, assuming we don’t uncover any issues with it.

It typically around two weeks for new CodeQL releases to make it into the cache we use to avoid downloading a release every time a workflow is run. You could add tools: latest to the parameters passed to the init step of your workflow if you would like to make sure it uses 2.9.1 now. This will add around a minute to your workflow’s duration but will ensure you always have the latest version without the couple of weeks delay for it to get into the cache.

Good point. Let’s keep this open until a fix is shipped.