Skip to content

Commit

Permalink
feat(java): Put java and spark libraries within a directory `maven-pr…
Browse files Browse the repository at this point in the history
…ojects` to help easily manage and extend the multi-module maven projects (#474)



---------

Signed-off-by: acezen <[email protected]>
  • Loading branch information
acezen authored May 8, 2024
1 parent b33c1f0 commit 71f57b3
Show file tree
Hide file tree
Showing 176 changed files with 64 additions and 64 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ on:
branches:
- main
paths:
- 'java/**'
- 'maven-projects/java/**'
- '.github/workflows/java.yml'
pull_request:
branches:
- main
paths:
- 'java/**'
- 'maven-projects/java/**'
- '.github/workflows/java.yml'

concurrency:
Expand Down Expand Up @@ -61,22 +61,22 @@ jobs:
sudo apt-get install llvm-11 clang-11 lld-11 libclang-11-dev libz-dev -y
- name: Code Format Check
working-directory: java
working-directory: maven-projects/java
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
mvn --no-transfer-progress spotless:check
- name: Build Java Docs
working-directory: java
working-directory: maven-projects/java
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
mvn --no-transfer-progress javadoc:javadoc
- name: Run test
working-directory: java
working-directory: maven-projects/java
run: |
# Temporarily using Java 8, related issue: https://github.com/apache/incubator-graphar/issues/277
export JAVA_HOME=${JAVA_HOME_8_X64}
export LLVM11_HOME=/usr/lib/llvm-11
export GAR_TEST_DATA=$PWD/../testing/
export GAR_TEST_DATA=$PWD/../../testing/
mvn --no-transfer-progress clean test -Dspotless.check.skip=true
4 changes: 2 additions & 2 deletions .github/workflows/pyspark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ on:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- 'pyspark/**'
- '.github/workflows/pyspark.yml'
pull_request:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- 'pyspark/**'
- '.github/workflows/pyspark.yml'

Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/spark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ on:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- '.github/workflows/spark.yaml'
pull_request:
branches:
- main
paths:
- 'spark/**'
- 'maven-projects/spark/**'
- '.github/workflows/spark.yaml'

concurrency:
Expand All @@ -57,20 +57,20 @@ jobs:
submodules: true

- name: Code Format Check
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
mvn --no-transfer-progress spotless:check
- name: Build GraphAr Spark
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
echo "Build ${{ matrix.mvn-profile }}"
mvn --no-transfer-progress clean package -DskipTests -Dspotless.check.skip=true -P ${{ matrix.mvn-profile }}
- name: Build Spark Docs
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
echo "Build ${{ matrix.mvn-profile }}"
Expand All @@ -79,15 +79,15 @@ jobs:
mvn --no-transfer-progress scala:doc
- name: Run test
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
export SPARK_TESTING=1
echo "Test ${{ matrix.mvn-profile }}"
mvn test --no-transfer-progress -Dspotless.check.skip=true -P ${{ matrix.mvn-profile }}
- name: Run Neo4j2GraphAr example
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
scripts/get-spark-to-home.sh ${{ matrix.spark }} ${{ matrix.spark-hadoop }}
Expand All @@ -112,7 +112,7 @@ jobs:
scripts/run-graphar2neo4j.sh
- name: Run Nebula2GraphAr example
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
scripts/get-nebula-to-home.sh
Expand All @@ -138,7 +138,7 @@ jobs:
scripts/run-graphar2nebula.sh
- name: Run Neo4j importer
working-directory: spark
working-directory: maven-projects/spark
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
export SPARK_HOME="${HOME}/${{ matrix.spark-hadoop }}"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ programming language.
### The C++ Library

See [GraphAr C++
Library](https://github.com/apache/incubator-graphar/tree/main/cpp) for
Library](./cpp) for
details about the building of the C++ library.

### The Java Library
Expand All @@ -213,20 +213,20 @@ The GraphAr Java library is created with bindings to the C++ library
(currently at version v0.10.0), utilizing
[Alibaba-FastFFI](https://github.com/alibaba/fastFFI) for
implementation. See [GraphAr Java
Library](https://github.com/apache/incubator-graphar/tree/main/java) for
Library](./maven-projects/java) for
details about the building of the Java library.

### The Spark Library

See [GraphAr Spark
Library](https://github.com/apache/incubator-graphar/tree/main/spark)
Library](./maven-projects/spark)
for details about the Spark library.

### The PySpark Library

The GraphAr PySpark library is developed as bindings to the GraphAr
Spark library. See [GraphAr PySpark
Library](https://github.com/apache/incubator-graphar/tree/main/pyspark)
Library](./pyspark)
for details about the PySpark library.

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion docs/libraries/java/how_to_develop_java.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Please refer to
## How To Test

```bash
$ export GAR_TEST_DATA=$PWD/../testing/
$ export GAR_TEST_DATA=$PWD/../../testing/
$ mvn clean test
```

Expand Down
10 changes: 5 additions & 5 deletions docs/libraries/java/java.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ directory:
$ git clone https://github.com/apache/incubator-graphar.git
$ cd incubator-graphar
$ git submodule update --init
$ cd java
$ cd maven-projects/java
```

Compile package:
Expand All @@ -88,7 +88,7 @@ Then set GraphAr as a dependency in maven project:
<dependencies>
<dependency>
<groupId>org.apache.graphar</groupId>
<artifactId>gar-java</artifactId>
<artifactId>java</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
Expand Down Expand Up @@ -120,7 +120,7 @@ if (!graphInfoResult.hasError()) {
```

See [test for
graphinfo](https://github.com/apache/incubator-graphar/tree/main/java/src/test/java/org/apache/graphar/graphinfo)
graphinfo](https://github.com/apache/incubator-graphar/blob/main/maven-projects/java/src/test/java/org/apache/graphar/graphinfo)
for the complete example.

### Writers
Expand Down Expand Up @@ -177,7 +177,7 @@ writer.sortAndWriteAdjListTable(table, 0, 0); // Write adj list of vertex chunk
```

See [test for
writers](https://github.com/apache/incubator-graphar/tree/main/java/src/test/java/org/apache/graphar/writers)
writers](https://github.com/apache/incubator-graphar/blob/main/maven-projects/java/src/test/java/org/apache/graphar/writers)
for the complete example.

### Readers
Expand Down Expand Up @@ -211,5 +211,5 @@ StdPair<Long, Long> range = reader.getRange().value();
```

See [test for
readers](https://github.com/apache/incubator-graphar/tree/main/java/src/test/java/org/apache/graphar/readers)
readers](https://github.com/apache/incubator-graphar/blob/main/maven-projects/java/src/test/java/org/apache/graphar/readers)
for the complete example.
2 changes: 1 addition & 1 deletion docs/libraries/pyspark/pyspark.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ You cannot install graphar-pyspark from PyPi for now.
### Initialization

GraphAr PySpark is not a standalone library but bindings to GraphAr
Scala. You need to have *graphar-spark-x.x.x.jar* in your *spark-jars*.
Scala. You need to have *spark-x.x.x.jar* in your *spark-jars*.
Please refer to [GraphAr scala documentation](../spark/spark.md) to get
this JAR.

Expand Down
10 changes: 5 additions & 5 deletions docs/libraries/spark/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ See [GraphAr2Neo4j.scala][graphar2neo4j] for the complete example.

:::

[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[transformer-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[transformer-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
22 changes: 11 additions & 11 deletions docs/libraries/spark/spark.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ For more information on its usage, please refer to the [Examples](examples.md).

### Building from source

Make the graphar-spark-library directory as the current working directory:
Make the spark-library directory as the current working directory:

```bash
cd incubator-graphar/spark/
cd incubator-graphar/maven_projects/spark/
```

Compile package:
Expand Down Expand Up @@ -226,12 +226,12 @@ For more information on usage, please refer to the examples:
- [Neo4j2GraphAr.scala][neo4j2graphar] and [GraphAr2Neo4j.scala][graphar2neo4j] are examples to conduct data importing/exporting for Neo4j.


[test-graph-info]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestGraphInfo.scala
[test-index-generator]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestIndexGenerator.scala
[test-writer]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestWriter.scala
[test-reader]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestReader.scala
[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[transform-example]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
[test-graph-info]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestGraphInfo.scala
[test-index-generator]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestIndexGenerator.scala
[test-writer]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestWriter.scala
[test-reader]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestReader.scala
[test-graph-transformer]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TestGraphTransformer.scala
[compute-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/ComputeExample.scala
[transform-example]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/test/scala/org/apache/graphar/TransformExample.scala
[neo4j2graphar]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/Neo4j2GraphAr.scala
[graphar2neo4j]: https://github.com/apache/incubator-graphar/blob/main/maven-projects/spark/graphar/src/main/scala/org/apache/graphar/example/GraphAr2Neo4j.scala
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions java/README.md → maven-projects/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Make the graphar-java-library directory as the current working directory:
$ git clone https://github.com/apache/incubator-graphar.git
$ cd incubator-graphar
$ git submodule update --init
$ cd java
$ cd maven-projects/java
```

Compile package:
Expand All @@ -64,7 +64,7 @@ Then set GraphAr as a dependency in maven project:
<dependencies>
<dependency>
<groupId>org.apache.graphar</groupId>
<artifactId>gar-java</artifactId>
<artifactId>java</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>
Expand All @@ -82,4 +82,4 @@ The API document will be generated in the `target/site/apidocs` directory.

## How to use

Please refer to [GraphAr Java Library Documentation](https://graphar.apache.org/GraphAr/user-guide/java-lib.html).
Please refer to [GraphAr Java Library Documentation](https://graphar.apache.org/docs/libraries/java/).
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions java/pom.xml → maven-projects/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>gar-java</artifactId>
<artifactId>java</artifactId>
<packaging>jar</packaging>

<name>gar-java</name>
<name>java</name>

<properties>
<native.library.name>gar-java</native.library.name>
<native.library.name>java</native.library.name>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -49,8 +49,8 @@
<arrow.version>13.0.0</arrow.version>
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>
<maven.javadoc.version>3.4.0</maven.javadoc.version>
<javadoc.output.directory>gar-java-javadoc</javadoc.output.directory>
<javadoc.output.destDir>gar-java-javadoc</javadoc.output.destDir>
<javadoc.output.directory>graphar-javadoc</javadoc.output.directory>
<javadoc.output.destDir>graphar-javadoc</javadoc.output.destDir>
<buildGarCPP>ON</buildGarCPP>
</properties>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions spark/README.md → maven-projects/spark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ repository and navigated to the ``spark`` subdirectory:
$ git clone https://github.com/apache/incubator-graphar.git
$ cd incubator-graphar
$ git submodule update --init
$ cd spark
$ cd mavens-projects/spark
```


Build the package:

```bash
$ mvn clean package -DskipTests
$ mvn clean install -DskipTests
```

GraphAr Spark uses Maven Profiles to support multiple Spark Versions. By default it is built with Spark 3.2.x or profile `datasources-32`. To built with Spark 3.3.4 use `-P datasources-33` (`mvn clean package -DskipTests -P datasources-33`).
GraphAr Spark uses Maven Profiles to support multiple Spark Versions. By default it is built with Spark 3.2.x or profile `datasources-32`. To built with Spark 3.3.4 use `-P datasources-33` (`mvn clean install -DskipTests -P datasources-33`).

After compilation, the package file graphar-x.x.x-SNAPSHOT-shaded.jar is generated in the directory ``spark/graphar/target/``.

Build the package and run the unit tests:

```bash
$ mvn clean package
$ mvn clean install
```

Build and run the unit tests:
Expand Down Expand Up @@ -231,4 +231,4 @@ The example will import the basketballplayer graph from GraphAr to NebulaGraph a

## How to use

Please refer to our [GraphAr Spark Library Documentation](https://graphar.apache.org/GraphAr/spark/spark-lib.html).
Please refer to our [GraphAr Spark Library Documentation](https://graphar.apache.org/docs/libraries/spark/).
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<parent>
<groupId>org.apache.graphar</groupId>
<artifactId>graphar-spark</artifactId>
<artifactId>spark</artifactId>
<version>${graphar.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<parent>
<groupId>org.apache.graphar</groupId>
<artifactId>graphar-spark</artifactId>
<artifactId>spark</artifactId>
<version>${graphar.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<parent>
<groupId>org.apache.graphar</groupId>
<artifactId>graphar-spark</artifactId>
<artifactId>spark</artifactId>
<version>${graphar.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
Expand Down
Loading

0 comments on commit 71f57b3

Please sign in to comment.