secure-software-engineering / FlowDroid

FlowDroid Static Data Flow Tracker
GNU Lesser General Public License v2.1
1.02k stars 292 forks source link

Build Failure From Maven Caused by jakarta.servlet-api #627

Closed wcphkust closed 1 year ago

wcphkust commented 1 year ago

Hi @StevenArzt and @timll,

I am trying to build the FlowDroid from maven. My java version is 1.8.0_352 and the maven version is 3.8.6. However, I encountered the following problem:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile (default-testCompile) on project soot-infoflow: Compilation failure
[ERROR] /Users/xiangqian/Documents/CodeBase/FlowDroid/soot-infoflow/test/soot/jimple/infoflow/test/securibench/supportClasses/DummyHttpSession.java:[17,23] cannot access jakarta.servlet.ServletContext
[ERROR]   bad class file: /Users/xiangqian/.m2/repository/jakarta/servlet/jakarta.servlet-api/6.0.0/jakarta.servlet-api-6.0.0.jar(jakarta/servlet/ServletContext.class)
[ERROR]     class file has wrong version 55.0, should be 52.0
[ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :soot-infoflow

Even if I use the command mvn -DskipTests install to disable tests, the error still appears. How can I handle it?

I am using FlowDroid as the fundamental engine to evaluate my own analysis. I need to reconfigure the summary models, so I have to build FlowDroid by myself instead of using the prebuilt release directly. Could you please give me any guidance?

timll commented 1 year ago

It seems that the library from maven is compiled with Java 11 but our tests are still stuck on Java 8. Maybe try to clean and rebuild the project again? Otherwise, you can also delete the securibench test code in your project. We have plenty of other tests and the securibench tests run without summaries, so changes in StubDroid aren't tested by these tests anyways.

Even if I use the command mvn -DskipTests install to disable tests, the error still appears. How can I handle it?

I'd suggest you to build FlowDroid without tests. The full test suite needs around 30 minutes on our beefy CI server.

wcphkust commented 1 year ago

@timll Thank you! I removed the test cases and then built the code successfully.