github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.67k stars 1.54k forks source link

General issue:create java project database failed #14933

Closed Maskhe closed 11 months ago

Maskhe commented 11 months ago

This is all error information I got,the target project is log4j2:

image

but I can create database for other java projects except the above-mentioned project

jketema commented 11 months ago

Hi @Maskhe,

The database directory should contain some log files created during the failed build, could you share those?

Maskhe commented 11 months ago

@jketema Thanks for your help:

[2023-11-28 15:18:43] This is codeql database create ../Log4jDB --overwrite --language=java --source-root=C:\Users\hjx\IdeaProjects\logging-log4j2 --command=mvn clean package -DskipTests -file pom.xml [2023-11-28 15:18:43] Log file was started late. [2023-11-28 15:18:43] [PROGRESS] database create> Initializing database at C:\Users\hjx\IdeaProjects\Log4jDB. [2023-11-28 15:18:43] Running plumbing command: codeql database init --overwrite --language=java --extractor-options-verbosity=1 --qlconfig-file=C:\Users\hjx\IdeaProjects\logging-log4j2\qlconfig.yml --source-root=C:\Users\hjx\IdeaProjects\logging-log4j2 --allow-missing-source-root=false --allow-already-existing -- C:\Users\hjx\IdeaProjects\Log4jDB [2023-11-28 15:18:43] Calling plumbing command: codeql resolve languages --extractor-options-verbosity=1 --format=betterjson [2023-11-28 15:18:43] [DETAILS] resolve languages> Scanning for [codeql-extractor.yml] from C:\Users\hjx\codeql.codeqlmanifest.json [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\cpp\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\csharp\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\csv\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\go\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\html\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\java\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\javascript\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\properties\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\python\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\ruby\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\swift\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\xml\codeql-extractor.yml. [2023-11-28 15:18:43] [DETAILS] resolve languages> Parsing C:\Users\hjx\codeql\yaml\codeql-extractor.yml. [2023-11-28 15:18:43] Plumbing command codeql resolve languages completed: { "aliases" : { "c" : "cpp", "c++" : "cpp", "c-c++" : "cpp", "c-cpp" : "cpp", "c#" : "csharp", "java-kotlin" : "java", "kotlin" : "java", "javascript-typescript" : "javascript", "typescript" : "javascript" }, "extractors" : { "cpp" : [ { "extractor_root" : "C:\Users\hjx\codeql\cpp" } ], "csharp" : [ { "extractor_root" : "C:\Users\hjx\codeql\csharp", "extractor_options" : { "trap" : { "title" : "Options pertaining to TRAP.", "description" : "Options pertaining to TRAP.", "type" : "object", "properties" : { "compression" : { "title" : "Controls compression for the TRAP files written by the extractor.", "description" : "This option is only intended for use in debugging the extractor. Accepted values are 'brotli' (the default, to write brotli-compressed TRAP), 'gzip', and 'none' (to write uncompressed TRAP).\n", "type" : "string", "pattern" : "^(none|gzip|brotli)$" } } }, "buildless" : { "title" : "Whether to use buildless (standalone) extraction.", "description" : "A value indicating, which type of extraction the autobuilder should perform. If 'true', then the standalone extractor will be used, otherwise tracing extraction will be performed. The default is 'false'. Note that buildless extraction will generally yield less accurate analysis results, and should only be used in cases where it is not possible to build the code (for example if it uses inaccessible dependencies).\n", "type" : "string", "pattern" : "^(false|true)$" }, "cil" : { "title" : "Whether to enable CIL extraction.", "description" : "A value indicating, whether CIL extraction should be enabled. The default is 'true'.\n", "type" : "string", "pattern" : "^(false|true)$" } } } ], "csv" : [ { "extractor_root" : "C:\Users\hjx\codeql\csv" } ], "go" : [ { "extractor_root" : "C:\Users\hjx\codeql\go" } ], "html" : [ { "extractor_root" : "C:\Users\hjx\codeql\html" } ], "java" : [ { "extractor_root" : "C:\Users\hjx\codeql\java", "extractor_options" : { "exclude" : { "title" : "A glob excluding files from analysis.", "description" : "A glob indicating what files to exclude from the analysis.\n", "type" : "string" }, "add_prefer_source" : { "title" : "Whether to always prefer source files over class files.", "description" : "A value indicating whether source files should be preferred over class files. If set to 'true', the extraction adds '-Xprefer:source' to the javac command line. If set to 'false', the extraction uses the default javac behavior ('-Xprefer:newer'). The default is 'true'.\n", "type" : "string", "pattern" : "^(false|true)$" }, "buildless" : { "title" : "Whether to use buildless (standalone) extraction (experimental).", "description" : "A value indicating, which type of extraction the autobuilder should perform. If 'true', then the standalone extractor will be used, otherwise tracing extraction will be performed. The default is 'false'. Note that buildless extraction will generally yield less accurate analysis results, and should only be used in cases where it is not possible to build the code (for example if it uses inaccessible dependencies).\n", "type" : "string", "pattern" : "^(false|true)$" } } } ], "javascript" : [ { "extractor_root" : "C:\Users\hjx\codeql\javascript", "extractor_options" : { } } ], "properties" : [ { "extractor_root" : "C:\Users\hjx\codeql\properties" } ], "python" : [ { "extractor_root" : "C:\Users\hjx\codeql\python" } ], "ruby" : [ { "extractor_root" : "C:\Users\hjx\codeql\ruby", "extractor_options" : { "trap" : { "title" : "Options pertaining to TRAP.", "description" : "Options pertaining to TRAP.", "type" : "object", "properties" : { "compression" : { "title" : "Controls compression for the TRAP files written by the extractor.", "description" : "This option is only intended for use in debugging the extractor. Accepted values are 'gzip' (the default, to write gzip-compressed TRAP) and 'none' (to write uncompressed TRAP).\n", "type" : "string", "pattern" : "^(none|gzip)$" } } } } } ], "swift" : [ { "extractor_root" : "C:\Users\hjx\codeql\swift" } ], "xml" : [ { "extractor_root" : "C:\Users\hjx\codeql\xml" } ], "yaml" : [ { "extractor_root" : "C:\Users\hjx\codeql\yaml" } ] } } [2023-11-28 15:18:43] [PROGRESS] database init> Calculating baseline information in C:\Users\hjx\IdeaProjects\logging-log4j2 [2023-11-28 15:18:43] [SPAMMY] database init> Ignoring the following directories when processing baseline information: .git, .hg, .svn. [2023-11-28 15:18:43] [DETAILS] database init> Running command in C:\Users\hjx\IdeaProjects\logging-log4j2: C:\Users\hjx\codeql\tools\win64\scc.exe --by-file --exclude-dir .git,.hg,.svn --format json --no-large --no-min . [2023-11-28 15:18:43] Using configure-baseline script C:\Users\hjx\codeql\javascript\tools\configure-baseline.cmd. [2023-11-28 15:18:44] [PROGRESS] database init> Running command in C:\Users\hjx\IdeaProjects\logging-log4j2: [C:\Users\hjx\codeql\javascript\tools\configure-baseline.cmd] [2023-11-28 15:18:44] [SPAMMY] database init> Found 2518 baseline files for java. [2023-11-28 15:18:44] [SPAMMY] database init> Found 1 baseline files for javascript. [2023-11-28 15:18:44] [PROGRESS] database init> Calculated baseline information for languages: java, javascript (302ms). [2023-11-28 15:18:44] [PROGRESS] database init> Resolving extractor java. [2023-11-28 15:18:44] [DETAILS] database init> Found candidate extractor root for java: C:\Users\hjx\codeql\java. [2023-11-28 15:18:44] [PROGRESS] database init> Successfully loaded extractor Java/Kotlin (java) from C:\Users\hjx\codeql\java. [2023-11-28 15:18:44] [PROGRESS] database init> Created skeleton CodeQL database at C:\Users\hjx\IdeaProjects\Log4jDB. This in-progress database is ready to be populated by an extractor. [2023-11-28 15:18:44] Plumbing command codeql database init completed. [2023-11-28 15:18:44] [PROGRESS] database create> Running build command: [mvn, clean, package, -DskipTests, -file, pom.xml] [2023-11-28 15:18:44] Running plumbing command: codeql database trace-command --working-dir=C:\Users\hjx\IdeaProjects\logging-log4j2 --index-traceless-dbs --no-db-cluster -- C:\Users\hjx\IdeaProjects\Log4jDB mvn clean package -DskipTests -file pom.xml [2023-11-28 15:18:44] [PROGRESS] database trace-command> Running command in C:\Users\hjx\IdeaProjects\logging-log4j2: [mvn, clean, package, -DskipTests, -file, pom.xml] [2023-11-28 15:18:44] [build-stderr] Error: Could not create the Java Virtual Machine. [2023-11-28 15:18:44] [build-stderr] Error: A fatal exception has occurred. Program will exit. [2023-11-28 15:18:44] [build-stderr] Unrecognized option: --add-exports [2023-11-28 15:18:44] [ERROR] Spawned process exited abnormally (code 1; tried to run: [C:\Users\hjx\codeql\tools\win64\tracer.exe, C:\Users\hjx\codeql\tools\win64\runner.exe, cmd.exe, /C, type, NUL, &&, mvn, clean, package, -DskipTests, -file, pom.xml]) [2023-11-28 15:18:44] Exception caught at top level: Exit status 1 from command: [C:\Users\hjx\codeql\tools\win64\runner.exe, cmd.exe, /C, type, NUL, &&, mvn, clean, package, -DskipTests, -file, pom.xml] com.semmle.cli2.Commandline.executeAndCheckResult(Commandline.java:170) com.semmle.cli2.Commandline.runWithoutReturn(Commandline.java:123) com.semmle.cli2.database.DatabaseProcessCommandCommon.executeSubcommand(DatabaseProcessCommandCommon.java:226) com.semmle.cli2.database.TraceCommandCommand.executeSubcommand(TraceCommandCommand.java:110) com.semmle.cli2.picocli.SubcommandCommon.lambda$executeSubcommandWithMessages$5(SubcommandCommon.java:803) com.semmle.cli2.picocli.SubcommandCommon.withCompilationMessages(SubcommandCommon.java:442) com.semmle.cli2.picocli.SubcommandCommon.executeSubcommandWithMessages(SubcommandCommon.java:801) com.semmle.cli2.picocli.PlumbingRunner.run(PlumbingRunner.java:119) com.semmle.cli2.picocli.SubcommandCommon.runPlumbingInProcess(SubcommandCommon.java:199) com.semmle.cli2.database.CreateCommand.executeSubcommand(CreateCommand.java:176) com.semmle.cli2.picocli.SubcommandCommon.lambda$executeSubcommandWithMessages$5(SubcommandCommon.java:803) com.semmle.cli2.picocli.SubcommandCommon.withCompilationMessages(SubcommandCommon.java:442) com.semmle.cli2.picocli.SubcommandCommon.executeSubcommandWithMessages(SubcommandCommon.java:801) com.semmle.cli2.picocli.SubcommandCommon.toplevelMain(SubcommandCommon.java:685) com.semmle.cli2.picocli.SubcommandCommon.call(SubcommandCommon.java:666) com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:237) com.semmle.cli2.picocli.SubcommandMaker.runMain(SubcommandMaker.java:247) com.semmle.cli2.CodeQL.main(CodeQL.java:115)

Maskhe commented 11 months ago

It`s my fault, the log4j2 project require maven use jdk11, but my command line maven uses jdk8 (IDEA maven uses jdk11,so I dont figure it out), just set my command line maven jdk version to jdk11 fixs above-mentioned error. Thanks to @jketema again!