You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Graphhopper编译报MojoFailureException及运行配置问题求助

Hey there! Let's tackle these GraphHopper issues one by one—since you're new to the project and its environment, I'll break this down into clear, actionable steps to get you up and running.

Fixing the MojoFailureException in Bash Compilation

That MojoFailureException usually points to a Maven-related hiccup during the build process. Here's what you can try:

  • Verify your Maven and JDK versions: GraphHopper requires Java 11+ and Maven 3.6+. Run these commands in bash to check:

    java -version
    mvn -v
    

    If your versions are outdated, update them first—this is a super common root cause for build failures.

  • Clean and rebuild with skipped tests: Sometimes cached build files or failing tests block the core module compilation. Run this command to skip tests temporarily and get the core module built:

    mvn clean install -DskipTests
    

    This will wipe old build artifacts, download any missing dependencies, and compile all modules without running tests (you can run tests later once the core is working).

  • Fix corrupted Maven dependencies: If the error mentions missing or corrupted dependencies, delete the problematic folder in your local Maven repository (usually at ~/.m2/repository/com/graphhopper) and re-run the build command above. Maven will re-download fresh, uncorrupted dependencies.

Getting GraphHopper Running in IntelliJ

Running graphhopper.sh directly in IntelliJ isn't the right approach—let's set up the project properly:

  • Import the project as a Maven project: Open IntelliJ, go to File > Open, and select the pom.xml file in the root of your cloned GraphHopper repository. Let IntelliJ finish importing all Maven dependencies (this might take a minute, depending on your internet speed).

  • Run the core application via Java main class: Instead of the shell script, run the Java main class directly:

    1. Open the Maven panel on the right side of IntelliJ.
    2. Navigate to graphhopper > core > Plugins > spring-boot > spring-boot:run—click this to start the GraphHopper web service.
    3. Alternatively, create a custom Run Configuration: Go to Run > Edit Configurations, add a new Application configuration, set the main class to com.graphhopper.application.GraphHopperApplication, and add VM options like -Xmx4g (to give the app enough memory for graph processing).
  • Set build targets correctly: If you just need to compile the core module, in the Maven panel, right-click the core module and select Clean then Install. This does the same as the bash command but within IntelliJ's interface.

  • Fix dependency issues: If you see red underlines for dependencies, click the Reload All Maven Projects button in the Maven panel (the circular arrow icon) to refresh dependencies. Also, check your project's JDK setup: Go to File > Project Structure > Project and ensure the SDK is set to Java 11 or higher.

内容的提问来源于stack exchange,提问作者marpec

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 07:36:56