Skip to content

Commit

Permalink
Fix Maven Central Release Issues (#427)
Browse files Browse the repository at this point in the history
* Fix Maven Central Release Issues

* make sed portable

* updated README

* updated maven-release.sh

* bump version to 4.1.2
  • Loading branch information
conker84 authored Apr 13, 2022
1 parent d34149f commit efb005f
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 34 deletions.
41 changes: 14 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,55 +27,56 @@ This will open http://localhost:8000/ which will serve development docs.
You can build for Spark 2.4 with both Scala 2.11 and Scala 2.12

```
./mvnw clean package -P spark-2.4 -P scala-2.11
./mvnw clean package -P spark-2.4 -P scala-2.12
./maven-release.sh package 2.11 2.4
./maven-release.sh package 2.12 2.4
```

These commands will generate the corresponding targets
* `spark-2.4/target/neo4j-connector-apache-spark_2.11-4.0.1_for_spark_2.4.jar`
* `spark-2.4/target/neo4j-connector-apache-spark_2.12-4.0.1_for_spark_2.4.jar`
* `spark-2.4/target/neo4j-connector-apache-spark_2.11-<version>_for_spark_2.4.jar`
* `spark-2.4/target/neo4j-connector-apache-spark_2.12-<version>_for_spark_2.4.jar`


### Building for Spark 3

You can build for Spark 3 by running

```
./mvnw clean package -P spark-3 -P scala-2.12
./maven-release.sh package 2.12 3
```

This will generate `spark-3/target/neo4j-connector-apache-spark_2.12-4.0.1_for_spark_3.jar`
This will generate `spark-3/target/neo4j-connector-apache-spark_2.12-<version>_for_spark_3.jar`


## Integration with Apache Spark Applications

**spark-shell, pyspark, or spark-submit**

`$SPARK_HOME/bin/spark-shell --jars neo4j-connector-apache-spark_2.12-4.0.1_for_spark_3.jar`
`$SPARK_HOME/bin/spark-shell --jars neo4j-connector-apache-spark_2.12-<version>_for_spark_3.jar`

`$SPARK_HOME/bin/spark-shell --packages org.neo4j:neo4j-connector-apache-spark_2.12:4.0.1_for_spark_3`
`$SPARK_HOME/bin/spark-shell --packages org.neo4j:neo4j-connector-apache-spark_2.12:<version>_for_spark_3`

**sbt**

If you use the [sbt-spark-package plugin](https://github.com/databricks/sbt-spark-package), in your sbt build file, add:

```scala spDependencies += "org.neo4j/neo4j-connector-apache-spark_2.11:4.0.1_for_spark_2.4"```
```scala spDependencies += "org.neo4j/neo4j-connector-apache-spark_2.11:<version>_for_spark_2.4"```

Otherwise,

```scala
resolvers += "Spark Packages Repo" at "http://dl.bintray.com/spark-packages/maven"
libraryDependencies += "org.neo4j" % "neo4j-connector-apache-spark_2.12" % "4.0.1_for_spark_2.4"
libraryDependencies += "org.neo4j" % "neo4j-connector-apache-spark_2.12" % "<version>_for_spark_2.4"
```

Or, for Spark 3

```scala
resolvers += "Spark Packages Repo" at "http://dl.bintray.com/spark-packages/maven"
libraryDependencies += "org.neo4j" % "neo4j-connector-apache-spark_2.12" % "4.0.1_for_spark_3"
libraryDependencies += "org.neo4j" % "neo4j-connector-apache-spark_2.12" % "<version>_for_spark_3"
```

**maven**

In your pom.xml, add:

```xml
Expand All @@ -84,16 +85,9 @@ In your pom.xml, add:
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-connector-apache-spark_2.11</artifactId>
<version>4.0.1_for_spark_2.4</version>
<version>[version]_for_spark_2.4</version>
</dependency>
</dependencies>
<repositories>
<!-- list of other repositories -->
<repository>
<id>SparkPackagesRepo</id>
<url>http://dl.bintray.com/spark-packages/maven</url>
</repository>
</repositories>
```

In case of Spark 3
Expand All @@ -104,16 +98,9 @@ In case of Spark 3
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-connector-apache-spark_2.12</artifactId>
<version>4.0.1_for_spark_3</version>
<version>[version]_for_spark_3</version>
</dependency>
</dependencies>
<repositories>
<!-- list of other repositories -->
<repository>
<id>SparkPackagesRepo</id>
<url>http://dl.bintray.com/spark-packages/maven</url>
</repository>
</repositories>
```

For more info about the available version visit https://neo4j.com/developer/spark/overview/#_compatibility
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-connector-apache-spark</artifactId>
<version>4.1.1</version>
<version>4.1.2</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion doc/docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nav:
asciidoc:
attributes:
theme: docs
connector-version: 4.1.1
connector-version: 4.1.2
copyright: Neo4j Inc.
url-neo4j-product-gds-lib: https://neo4j.com/product/graph-data-science-library/
url-gh-spark-notebooks: https://github.com/utnaf/neo4j-connector-apache-spark-notebooks
Expand Down
2 changes: 1 addition & 1 deletion doc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-connector-apache-spark</artifactId>
<version>4.1.1</version>
<version>4.1.2</version>
</parent>

<properties>
Expand Down
61 changes: 61 additions & 0 deletions maven-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

if [[ $# -lt 3 ]] ; then
echo "Usage ./maven-release.sh <DEPLOY_OR_INSTALL> <SCALA-VERSION> <SPARK-VERSION> [<ALT_DEPLOYMENT_REPOSITORY>]"
exit 1
fi

JAVA_VER=$(java -version 2>&1 | grep -i version)

if [[ ! $JAVA_VER =~ 1.8 ]] ; then
echo "You must use Java 8"
exit 1
fi

exit_script() {
echo "Process terminated cleaning up resources"
mv -f pom.xml.bak pom.xml
mv -f common/pom.xml.bak common/pom.xml
mv -f doc/pom.xml.bak doc/pom.xml
mv -f test-support/pom.xml.bak test-support/pom.xml
mv -f "${TARGET_DIR}/pom.xml.bak" "${TARGET_DIR}/pom.xml"
trap - SIGINT SIGTERM # clear the trap
kill -- -$$ # Sends SIGTERM to child/sub processes
}

trap exit_script SIGINT SIGTERM

DEPLOY_INSTALL=$1
SCALA_VERSION=$2
SPARK_VERSION=$3
TARGET_DIR=spark-$SPARK_VERSION
if [[ $# -eq 4 ]] ; then
ALT_DEPLOYMENT_REPOSITORY="-DaltDeploymentRepository=$4"
else
ALT_DEPLOYMENT_REPOSITORY=""
fi

case $(sed --help 2>&1) in
*GNU*) sed_i () { sed -i "$@"; };;
*) sed_i () { sed -i '' "$@"; };;
esac

# backup files
cp pom.xml pom.xml.bak
cp common/pom.xml common/pom.xml.bak
cp doc/pom.xml doc/pom.xml.bak
cp test-support/pom.xml test-support/pom.xml.bak
cp "${TARGET_DIR}/pom.xml" "${TARGET_DIR}/pom.xml.bak"

# replace pom files with target scala version
sed_i "s/<artifactId>neo4j-connector-apache-spark<\/artifactId>/<artifactId>neo4j-connector-apache-spark_$SCALA_VERSION<\/artifactId>/" pom.xml
sed_i "s/<scala.binary.version \/>/<scala.binary.version>$SCALA_VERSION<\/scala.binary.version>/" pom.xml
sed_i "s/<artifactId>neo4j-connector-apache-spark<\/artifactId>/<artifactId>neo4j-connector-apache-spark_$SCALA_VERSION<\/artifactId>/" "doc/pom.xml"
sed_i "s/<artifactId>neo4j-connector-apache-spark<\/artifactId>/<artifactId>neo4j-connector-apache-spark_$SCALA_VERSION<\/artifactId>/" "common/pom.xml"
sed_i "s/<artifactId>neo4j-connector-apache-spark<\/artifactId>/<artifactId>neo4j-connector-apache-spark_$SCALA_VERSION<\/artifactId>/" "test-support/pom.xml"
sed_i "s/<artifactId>neo4j-connector-apache-spark<\/artifactId>/<artifactId>neo4j-connector-apache-spark_$SCALA_VERSION<\/artifactId>/" "${TARGET_DIR}/pom.xml"

# build
mvn clean $DEPLOY_INSTALL -pl !'doc' -Pscala-$SCALA_VERSION -Pspark-$SPARK_VERSION -DskipTests $ALT_DEPLOYMENT_REPOSITORY

exit_script
4 changes: 3 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.neo4j</groupId>
<packaging>pom</packaging>
<version>4.1.1</version>
<version>4.1.2</version>
<artifactId>neo4j-connector-apache-spark</artifactId>
<name>neo4j-connector-apache-spark</name>
<description>Neo4j Connector for Apache Spark using the binary Bolt Driver</description>
Expand Down Expand Up @@ -56,6 +56,8 @@
<node.version>v12.16.0</node.version>
<npm.version>6.13.7</npm.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- This is empty because we use it for the deploy process -->
<scala.binary.version />
</properties>

<profiles>
Expand Down
2 changes: 1 addition & 1 deletion spark-2.4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-connector-apache-spark</artifactId>
<version>4.1.1</version>
<version>4.1.2</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion spark-3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-connector-apache-spark</artifactId>
<version>4.1.1</version>
<version>4.1.2</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion test-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-connector-apache-spark</artifactId>
<version>4.1.1</version>
<version>4.1.2</version>
</parent>

<properties>
Expand Down

0 comments on commit efb005f

Please sign in to comment.