From 3320da19aa4730efe81a5222a1a1424a053a1205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Christian=20Seime?= Date: Tue, 1 Oct 2024 13:16:55 +0200 Subject: [PATCH 1/3] Configure Maven + Java version (mvnvm / jEnv) --- .java-version | 1 + mvnvm.properties | 1 + 2 files changed, 2 insertions(+) create mode 100644 .java-version create mode 100644 mvnvm.properties diff --git a/.java-version b/.java-version new file mode 100644 index 000000000000..98d9bcb75a68 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +17 diff --git a/mvnvm.properties b/mvnvm.properties new file mode 100644 index 000000000000..bdba25ce4d67 --- /dev/null +++ b/mvnvm.properties @@ -0,0 +1 @@ +mvn_version=3.8.8 From 31eed1da4e393b74414ec7c00103f5b5c780ddd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Christian=20Seime?= Date: Tue, 1 Oct 2024 13:30:26 +0200 Subject: [PATCH 2/3] Add README section on dev environment for Mac --- README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 32e216fef05c..519370bb7a53 100644 --- a/README.md +++ b/README.md @@ -77,11 +77,44 @@ Some suggested improvements with pointers to code are in [TODO.md](TODO.md). ### Development environment C++ and Java building is supported on AlmaLinux 8. -The Java source can also be built on any platform having Java 17 and Maven installed. +The Java source can also be built on any platform having Java 17 and Maven 3.8+ installed. Use the following guide to set up a complete development environment using Docker for building Vespa, running unit tests and running system tests: [Vespa development on AlmaLinux 8](https://github.com/vespa-engine/docker-image-dev#vespa-development-on-almalinux-8). +#### Java environment for Mac +1. Install [JDK17](https://openjdk.org/projects/jdk/17/), + [Maven Version Manager](https://bitbucket.org/mjensen/mvnvm/src/master/) and [jEnv](https://www.jenv.be) + through [Homebrew](https://brew.sh/). +```sh +brew install jenv mvnvm openjdk@17 +``` + +2. For the system Java wrappers to find this JDK, symlink it with +```sh +sudo ln -sfn /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk +``` + +3. Follow "Configure your shell" in https://www.jenv.be. Configuration is shell specific. For `zsh` use the below commands: +```sh +echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc +echo 'eval "$(jenv init -)"' >> ~/.zshrc +eval "$(jenv init -)" +jenv enable-plugin export +exec $SHELL -l +``` + +4. Add JDK17 to jEnv +```sh +jenv add $(/usr/libexec/java_home -v 17) +``` + +5. Verify configuration with Maven by executing below command in the root of the source code. + Output should refer to the JDK and Maven version specified in the [.java-version](.java-version) and [mvnvm.properties](mvnvm.properties). +```sh +mvn -v +``` + ### Build Java modules export MAVEN_OPTS="-Xms128m -Xmx1024m" From 31ac0db8723fa1157d9502638df4152ef89e1c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Christian=20Seime?= Date: Wed, 2 Oct 2024 16:12:37 +0200 Subject: [PATCH 3/3] Maven 3.9 is fine --- mvnvm.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvnvm.properties b/mvnvm.properties index bdba25ce4d67..38f63fe79206 100644 --- a/mvnvm.properties +++ b/mvnvm.properties @@ -1 +1 @@ -mvn_version=3.8.8 +mvn_version=3.9.9