Skip to content

Commit

Permalink
Merge pull request #32499 from vespa-engine/bjorncs/readme-java-build…
Browse files Browse the repository at this point in the history
…-mac

Bjorncs/readme java build mac
  • Loading branch information
bjorncs authored Oct 7, 2024
2 parents 5b4f200 + 31ac0db commit 17ce1e1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
17
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions mvnvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mvn_version=3.9.9

0 comments on commit 17ce1e1

Please sign in to comment.