0

I am trying to learn Codeql analysis tool and running into some issues while running the query.

I am able to successfully create the database upon running the command:

 codeql database create

But when I run the query:

codeql query run db-name

I keep getting the error 'could not resolve the module java' but I see the java folder in the codeql that I had extracted after initial installation.

Any pointers to resolve this is highly appreciated.

Thank you

Here is a sample application I have:

@SpringBootApplication
public class myApplication{
  public satic void main (String args[]){
     SpringApplication.run(myApplication.class, args);
  }
}

And here is a sample query I found on github that I am trying to run. This is supposed to return classes annotated with SpringBootApplication

import java

class SpringBootApplication extends Class{
  SpringBootApplication(){
    exists(Annotation annot |
     annot.getType().getName() = "SpringBootApplication" and
     annot.getAnnotatedElement() = this
   )
  }
}
2
  • It doesn't looks like Java. Commented Jun 16, 2024 at 20:54
  • The original code is java using SpringBoot. I am assuming you are looking at the second code snippet which is codeql query language that I am having issues with. Commented Jun 16, 2024 at 21:56

1 Answer 1

1

I was able to resolve it and here's how I did it:

  1. Placed qlpack.yml file in my code repository with following contents:
name: java-queries
version: 1.0.0
dependencies:
  codeql/java-queries:*.*
  1. Run the command : codeql pack install

Hope this helps anyone else who runs into this issue.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.