|
| 1 | += Graalvm Build Guide |
| 2 | + |
| 3 | +*1. Setup Graalvm* |
| 4 | + |
| 5 | +* Update the file under e.g. C\Projects\IDEasy\settings and add |
| 6 | +
|
| 7 | +[width="100%",cols="100%",options="header",] |
| 8 | +|=== |
| 9 | +a| |
| 10 | +GRAALVM_EDITION=community |
| 11 | +|=== |
| 12 | + |
| 13 | +This is necessary as the community edition of graalvm is delivered with a pre-installed native image. |
| 14 | + |
| 15 | +* Open a command-line interface inside a devon installation e.g. C\Projects\IDEasy\workspaces\main |
| 16 | +
|
| 17 | +* Install Graalvm using the devonfw-ide with |
| 18 | +
|
| 19 | +[width="100%",cols="100%",options="header",] |
| 20 | +|=== |
| 21 | +a| |
| 22 | +devon graalvm setup |
| 23 | +|=== |
| 24 | + |
| 25 | +When the installation is complete, the GRAALVM_HOME environment variable is automatically set to the graalvm installation path e.g. C/Projects/IDEasy/software/extra/graalvm |
| 26 | + |
| 27 | +* Restart your cli |
| 28 | +
|
| 29 | +* Add *$GRAALVM_HOME/bin* to your *PATH* environment variable |
| 30 | +
|
| 31 | +Bash: |
| 32 | + |
| 33 | +[width="100%",cols="100%",options="header",] |
| 34 | +|=== |
| 35 | +a| |
| 36 | +export PATH=$GRAALVM_HOME\bin:$PATH |
| 37 | +|=== |
| 38 | + |
| 39 | +Powershell (run as Admin): |
| 40 | + |
| 41 | +[width="100%",cols="100%",options="header",] |
| 42 | +|=== |
| 43 | +a| |
| 44 | +$path = [System.Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::Machine) + |
| 45 | +$newPath = "$env:GRAALVM_HOME\bin;" + $path + |
| 46 | +[System.Environment]::SetEnvironmentVariable("Path", $newPath, |
| 47 | +[System.EnvironmentVariableTarget]::Machine) |
| 48 | +|=== |
| 49 | + |
| 50 | +*2. Install Dependencies* |
| 51 | + |
| 52 | +*2.1 Windows: Install Visual Studio* |
| 53 | + |
| 54 | +* Download Visual Studio from https://visualstudio.microsoft.com/downloads/ |
| 55 | +
|
| 56 | +* During the installation, make sure to include the "Desktop development with CPP" workload, as this includes the necessary C/C++ compiler |
| 57 | +
|
| 58 | +image:images/cppInstall.png[image] |
| 59 | +* If you already have Visual Studio installed, open the Visual Studio installer and click “modifyˮ on your existing installation. |
| 60 | +Then select the C++ workload and click on install. |
| 61 | + |
| 62 | +*2.2 Linux* |
| 63 | + |
| 64 | +Install the zlib development package on your system: |
| 65 | + |
| 66 | +[width="100%",cols="100%",options="header",] |
| 67 | +|=== |
| 68 | +a| |
| 69 | +sudo apt-get update + |
| 70 | +sudo apt-get install zlib1g-dev |
| 71 | +|=== |
| 72 | + |
| 73 | +*3. Build Your Application* |
| 74 | + |
| 75 | +Run the following Maven command inside Intellij to compile your application and create an executable: |
| 76 | + |
| 77 | +[width="100%",cols="100%",options="header",] |
| 78 | +|=== |
| 79 | +a| |
| 80 | +-B -ntp -Pnative -DskipTests=true package |
| 81 | +|=== |
| 82 | + |
| 83 | +image:images/graalvmMvnArgs.png[image] |
| 84 | + |
| 85 | +*Alternatively you can build the project using a cli:* |
| 86 | + |
| 87 | +* Open *PowerShell* and check the java version with |
| 88 | +
|
| 89 | +[width="100%",cols="100%",options="header",] |
| 90 | +|=== |
| 91 | +a| |
| 92 | +java --version |
| 93 | +|=== |
| 94 | + |
| 95 | +If the java version is below 17, you need to specify a JDK with version >=17. |
| 96 | +e.g. |
| 97 | + |
| 98 | +[width="100%",cols="100%",options="header",] |
| 99 | +|=== |
| 100 | +a| |
| 101 | +$env:JAVA_HOME = "C:\Projects\IDEasy\software\java\" |
| 102 | +|=== |
| 103 | + |
| 104 | +This command sets the *JAVA_HOME* variable temporarily for the session and will be re-set after you close the shell. |
| 105 | + |
| 106 | +* Run the following Maven command in your project directory where the pom.xml is located to compile your application and create an executable: |
| 107 | +
|
| 108 | +[width="100%",cols="100%",options="header",] |
| 109 | +|=== |
| 110 | +a| |
| 111 | +PATH/TO/MVN/mvn -B -ntp -Pnative -DskipTests=true package |
| 112 | +|=== |
| 113 | + |
| 114 | +Example: |
| 115 | + |
| 116 | +[width="100%",cols="100%",options="header",] |
| 117 | +|=== |
| 118 | +a| |
| 119 | +C:\Projects\IDEasy\workspaces\main\IDEasy> C:\Projects\IDEasy\software\mvn\bin\mvn -B -ntp -Pnative -DskipTests=true package |
| 120 | +|=== |
| 121 | + |
| 122 | +Building the application might take up to 10 minutes depending on your machine. |
| 123 | + |
| 124 | +*4. Run your Application* + |
| 125 | +An ideasy executable (e.g. ideasy.exe under windows) should be created under *../workspace/main/IDEasy/cli/target*. |
| 126 | + |
| 127 | +To run the application open a cli and pass your arguments. |
| 128 | + |
| 129 | +Example: |
| 130 | + |
| 131 | +[width="100%",cols="100%",options="header",] |
| 132 | +|=== |
| 133 | +a| |
| 134 | +C:\Projects\IDEasy\workspaces\main\IDEasy\cli\target> .\ideasy.exe mvn --version |
| 135 | +|=== |
| 136 | + |
0 commit comments