Skip to content

Commit 1fdd808

Browse files
committed
Update building instructions
1 parent 9969c11 commit 1fdd808

File tree

1 file changed

+45
-22
lines changed

1 file changed

+45
-22
lines changed

BUILDING.md

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,23 @@
1717

1818
# Requirements
1919

20-
* JDK 8 and 9+
21-
* Apache Maven 3.x
20+
* JDK 11+
21+
* JDK 8 (optional)
22+
* Apache Maven 3.x (optional)
2223
* A modern Linux, OSX, or Windows host
2324

24-
<a name="toolchains"></a>
25-
# Configuring Maven Toolchains
26-
27-
Maven Toolchains is used to employ multiple JDKs required for compilation.
28-
You either need to have a user-level configuration in `~/.m2/toolchains.xml` or explicitly provide one to the Maven: `./mvnw --global-toolchains /path/to/toolchains.xml`.
29-
See [`.github/workflows/maven-toolchains.xml`](.github/workflows/maven-toolchains.xml) used by CI for a sample Maven Toolchains configuration.
30-
Note that this file requires `JAVA_HOME_8_X64` and `JAVA_HOME_11_X64` environment variables to be defined, though these can very well be hardcoded.
31-
3225
<a name="building"></a>
3326
# Building the sources
3427

3528
You can build and verify the sources as follows:
36-
37-
./mvnw verify
38-
29+
```sh
30+
./mvnw verify
31+
```
3932
`verify` goal runs validation and test steps next to building (i.e., compiling) the sources.
4033
To speed up the build, you can skip verification:
41-
42-
./mvnw -DskipTests package
43-
34+
```sh
35+
./mvnw -DskipTests package
36+
```
4437
If you want to install generated artifacts to your local Maven repository, replace above `verify` and/or `package` goals with `install`.
4538

4639
<a name="dns"></a>
@@ -50,16 +43,46 @@ Note that if your `/etc/hosts` file does not include an entry for your computer'
5043
many unit tests may execute slow due to DNS lookups to translate your hostname to an IP address in
5144
[`InetAddress.getLocalHost()`](http://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html#getLocalHost()).
5245
To remedy this, you can execute the following:
46+
```sh
47+
printf '127.0.0.1 %s\n::1 %s\n' `hostname` `hostname` | sudo tee -a /etc/hosts
48+
```
5349

54-
printf '127.0.0.1 %s\n::1 %s\n' `hostname` `hostname` | sudo tee -a /etc/hosts
50+
<a name="java8-tests"></a>
51+
# Java 8 tests
52+
53+
To test the library against the target JRE (JRE 8), you need to configure a JDK 8 toolchains as explained below and run Maven with the `java8-tests` profile:
54+
```sh
55+
./mvnw verify -Pjava8-tests
56+
```
57+
58+
<a name="toolchains"></a>
59+
## Configuring Maven Toolchains
60+
61+
Maven Toolchains is used to employ additional JDKs required for tests.
62+
You either need to have a user-level configuration in `~/.m2/toolchains.xml` or explicitly provide one to the Maven: `./mvnw --global-toolchains /path/to/toolchains.xml`.
63+
```xml
64+
<?xml version="1.0" encoding="UTF8"?>
65+
<toolchains>
66+
<toolchain>
67+
<type>jdk</type>
68+
<provides>
69+
<version>1.8.0_372</version>
70+
</provides>
71+
<configuration>
72+
<jdkHome>/usr/lib/jvm/java-8-openjdk-amd64</jdkHome>
73+
</configuration>
74+
</toolchain>
75+
</toolchains>
76+
```
5577

5678
<a name="website"></a>
5779
# Building the website and manual
5880

5981
You can build the website and manual as follows:
60-
61-
./mvnw site
62-
82+
```sh
83+
./mvnw site
84+
```
6385
And view it using a simple HTTP server, e.g., the one comes with the Python:
64-
65-
python3 -m http.server -d target/site
86+
```sh
87+
python3 -m http.server -d target/site
88+
```

0 commit comments

Comments
 (0)