Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added scripts for jar setup, and in-project maven repo #69

Merged
merged 1 commit into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pom.xml.asc
/classes/
/target/
/checkouts/
/maven_repository/
.lein-deps-sum
.lein-repl-history
.lein-plugins/
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
JAR_VERSION = 2.0.13
JAR_URL = https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_$(JAR_VERSION)/AthenaJDBC42_$(JAR_VERSION).jar

# Source: https://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/
download-jar:
mkdir -p maven_repository/athena/athena-jdbc/$(JAR_VERSION)/
cd maven_repository/athena/athena-jdbc/$(JAR_VERSION)/ \
&& curl $(JAR_URL) --output athena-jdbc-${JAR_VERSION}.jar --silent --show-error --continue-at - \
&& shasum athena-jdbc-$(JAR_VERSION).jar | cut -f "1" -d " " > athena-jdbc-$(JAR_VERSION).jar.sha1

build: download-jar
DEBUG=1 LEIN_SNAPSHOTS_IN_RELEASE=true lein uberjar
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,27 @@ Guide](https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.

### Build from source

I'm not familiar enough with `lein` to know if there is a better way to include a jar from a static URL, so for the time being we download it manually.

1. Download a fairly recent Metabase binary release (jar file) from the [Metabase distribution page](https://metabase.com/start/jar.html).

2. Download the Athena driver into your local Maven repo
2. Clone this repo

```shell
mkdir -p ~/.m2/repository/athena/athena-jdbc/2.0.13/
wget -O ~/.m2/repository/athena/athena-jdbc/2.0.13/athena-jdbc-2.0.13.jar https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.13/AthenaJDBC42_2.0.13.jar
git clone https://github.com/dacort/metabase-athena-driver
cd metabase-athena-driver/
```

3. Clone this repo
3. Download the Athena driver into a local in-project Maven repo

```shell
git clone https://github.com/dacort/metabase-athena-driver
make download-jar
```

4. Build the jar

```shell
cd metabase-athena-driver/
DEBUG=1 LEIN_SNAPSHOTS_IN_RELEASE=true lein uberjar
make build
# Alternative:
# DEBUG=1 LEIN_SNAPSHOTS_IN_RELEASE=true lein uberjar
```

5. Let's assume we download `metabase.jar` to `~/metabae/` and we built the project above. Copy the built jar to the Metabase plugins directly and run Metabase from there!
Expand Down
8 changes: 3 additions & 5 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
(defproject metabase/athena-driver "1.0.0-athena-jdbc-2.0.13"
:min-lein-version "2.5.0"

; Run `make download-jar` first, to initialize in-project maven repo and download third-party jar.
:repositories {"local" ~(str (.toURI (java.io.File. "maven_repository")))}

:dependencies
[[athena/athena-jdbc "2.0.13"]]

; :repositories
; [["athena" {:url "https://s3.amazonaws.com/athena-downloads/drivers/JDBC/SimbaAthenaJDBC_2.0.13/AthenaJDBC42_2.0.13.jar"}]]
; TODO: Download from source URL
; For now, you have to download the jar above into ~/.m2/repository/athena/athena-jdbc/2.0.13/athena-jdbc-2.0.13.jar

:aliases
{"test" ["with-profile" "+unit_tests" "test"]}

Expand Down