@@ -21,23 +21,23 @@ Add the required dependencies for GraalPy and JArrow in the dependency section o
2121### 3.1 GraalPy dependencies
2222` pom.xml `
2323``` xml
24- <dependency >
25- <groupId >org.graalvm.python</groupId >
26- <artifactId >python-community</artifactId > <!-- ① -->
27- <version >${python.version}</version >
28- <type >pom</type > <!-- ② -->
29- </dependency >
30- <dependency >
31- <groupId >org.graalvm.python</groupId >
32- <artifactId >python-embedding</artifactId > <!-- ③ -->
33- <version >${python.version}</version >
34- </dependency >
24+ <dependency >
25+ <groupId >org.graalvm.python</groupId >
26+ <artifactId >python-community</artifactId > <!-- ① -->
27+ <version >${python.version}</version >
28+ <type >pom</type > <!-- ② -->
29+ </dependency >
30+ <dependency >
31+ <groupId >org.graalvm.python</groupId >
32+ <artifactId >python-embedding</artifactId > <!-- ③ -->
33+ <version >${python.version}</version >
34+ </dependency >
3535```
3636
3737or
3838
3939` build.gradle `
40- ```
40+ ``` groovy
4141implementation "org.graalvm.python:python-community:$pythonVersion" // ①
4242implementation "org.graalvm.python:python-embedding:$pythonVersion" // ③
4343```
@@ -95,10 +95,6 @@ There is also another option `arrow-memory-netty`. You can read more about Apach
9595 <package >pandas</package > <!-- ② -->
9696 <package >pyarrow</package > <!-- ③ -->
9797 </packages >
98- <pythonHome >
99- <includes ></includes >
100- <excludes >.*</excludes >
101- </pythonHome >
10298 </configuration >
10399 <goals >
104100 <goal >process-graalpy-resources</goal >
@@ -212,6 +208,8 @@ Bind the Java interface to the Python module.
212208` Main.java `
213209
214210``` java
211+ private static DataAnalysisPyModule dataAnalysisPyModule;
212+
215213 public static void initDataAnalysisPyModule(Context context) {
216214 Value value = context. eval(" python" , " import data_analysis; data_analysis" );
217215 dataAnalysisPyModule = value. as(DataAnalysisPyModule . class);
@@ -252,6 +250,11 @@ Finally, use the setup in your main method:
252250
253251` Main.java `
254252``` java
253+ private static final String PYTHON_URL = " https://www.graalvm.org/compatibility/module_results/python-module-testing-v241.csv" ;
254+ private static final String JAVASCRIPT_URL = " https://www.graalvm.org/compatibility/module_results/js-module-testing.csv" ;
255+ private static final Integer PASSING_RATE_COLUMN_INDEX = 3 ;
256+
257+
255258 public static void main(String [] args) throws IOException , InterruptedException {
256259 try (Context context = initContext();
257260 BufferAllocator allocator = new RootAllocator ();
285288./gradlew build
286289```
287290
288- To run the application:
291+ To run the application using Maven, first define ` exec ` plugin:
292+
293+ ` pom.xml `
294+ ``` xml
295+ <plugin >
296+ <groupId >org.codehaus.mojo</groupId >
297+ <artifactId >exec-maven-plugin</artifactId >
298+ <version >1.2.1</version >
299+ <executions >
300+ <execution >
301+ <goals >
302+ <goal >java</goal >
303+ </goals >
304+ </execution >
305+ </executions >
306+ <configuration >
307+ <mainClass >com.example.Main</mainClass >
308+ </configuration >
309+ </plugin >
310+ ```
311+ Run the application using:
289312``` bash
290313./mvnw exec:java -Dexec.mainClass=" com.example.Main"
291314```
0 commit comments