Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 53ae3fe

Browse files
Maven: shorten README a bit by combining and collapsing steps
1 parent 1e084f8 commit 53ae3fe

File tree

1 file changed

+57
-38
lines changed

1 file changed

+57
-38
lines changed

‎java-main-maven/README.md‎

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
This example shows how to use ObjectBox in a simple note-taking Java console application running on
44
the JVM. The project is built with Maven.
55

6-
If you have been using the ObjectBox Gradle plugin, note that there are some differences in how a
6+
> [!NOTE]
7+
> If you have been using the ObjectBox Gradle plugin, note that there are some differences in how a
78
Maven project is set up (see below).
89

910
This example is separate from the other examples. For example to use it in your IDE, you can just
@@ -46,64 +47,85 @@ We recommend to add a property to specify the ObjectBox version:
4647

4748
### Add dependencies
4849

49-
Next, add the ObjectBox Java library to the `<dependencies>` block:
50+
Add the ObjectBox Java library and a runtime library for each platform that your application should
51+
run on to the `<dependencies>` block:
5052

5153
```xml
54+
<!-- ObjectBox Java APIs -->
5255
<dependency>
5356
<groupId>io.objectbox</groupId>
5457
<artifactId>objectbox-java</artifactId>
5558
<version>${objectboxVersion}</version>
5659
</dependency>
57-
```
58-
59-
For Kotlin projects, you can optionally add `objectbox-kotlin` which provides some extension
60-
functions.
6160

62-
Additionally, add a library for each platform that your application should run on:
63-
64-
```xml
61+
<!--
62+
ObjectBox platform-specific runtime libraries.
63+
Add or remove them as needed to match what your application supports.
64+
-->
6565
<!-- Linux (x64) -->
6666
<dependency>
6767
<groupId>io.objectbox</groupId>
6868
<artifactId>objectbox-linux</artifactId>
6969
<version>${objectboxVersion}</version>
7070
</dependency>
7171

72-
<!-- Linux (32-bit ARM) -->
72+
<!-- macOS (Intel and Apple Silicon) -->
7373
<dependency>
7474
<groupId>io.objectbox</groupId>
75-
<artifactId>objectbox-linux-armv7</artifactId>
75+
<artifactId>objectbox-macos</artifactId>
7676
<version>${objectboxVersion}</version>
7777
</dependency>
7878

79-
<!-- Linux (64-bit ARM) -->
79+
<!-- Windows (x64) -->
8080
<dependency>
8181
<groupId>io.objectbox</groupId>
82-
<artifactId>objectbox-linux-arm64</artifactId>
82+
<artifactId>objectbox-windows</artifactId>
8383
<version>${objectboxVersion}</version>
8484
</dependency>
85+
```
8586

86-
<!-- macOS (Intel and Apple Silicon) -->
87+
<details>
88+
89+
<summary><b>Additional ObjectBox runtime libraries</b></summary>
90+
91+
```xml
92+
<!-- Linux (32-bit ARM) -->
8793
<dependency>
8894
<groupId>io.objectbox</groupId>
89-
<artifactId>objectbox-macos</artifactId>
95+
<artifactId>objectbox-linux-armv7</artifactId>
9096
<version>${objectboxVersion}</version>
9197
</dependency>
9298

93-
<!-- Windows (x64) -->
99+
<!-- Linux (64-bit ARM) -->
94100
<dependency>
95101
<groupId>io.objectbox</groupId>
96-
<artifactId>objectbox-windows</artifactId>
102+
<artifactId>objectbox-linux-arm64</artifactId>
97103
<version>${objectboxVersion}</version>
98104
</dependency>
99105
```
100106

107+
</details>
108+
109+
<details>
110+
111+
<summary><b>Optional Kotlin extensions library</b></summary>
112+
113+
```xml
114+
<dependency>
115+
<groupId>io.objectbox</groupId>
116+
<artifactId>objectbox-kotlin</artifactId>
117+
<version>${objectboxVersion}</version>
118+
</dependency>
119+
```
120+
121+
</details>
122+
101123
Or to use [ObjectBox Sync](https://objectbox.io/sync/) (requires access to the Sync feature) add the
102124
Sync variants instead:
103125

104126
<details>
105127

106-
<summary>ObjectBox platform libraries for Sync</summary>
128+
<summary><b>Available ObjectBox runtime libraries for Sync</b></summary>
107129

108130
```xml
109131
<!-- Linux (x64) -->
@@ -144,9 +166,13 @@ Sync variants instead:
144166

145167
</details>
146168

147-
### Configure the annotation processor
169+
### Add the annotation processor and Maven plugin
170+
171+
> [!NOTE]
172+
> The ObjectBox Maven Plugin is available from [Maven Central](https://central.sonatype.com/artifact/io.objectbox/objectbox-maven-plugin).
148173
149-
Next, add and configure the ObjectBox annotation processor within the Maven Compiler plugin:
174+
Add and configure the ObjectBox annotation processor within the Maven Compiler plugin, and add the
175+
ObjectBox Maven Plugin to the build plugins block:
150176

151177
```xml
152178
<build>
@@ -173,19 +199,12 @@ Next, add and configure the ObjectBox annotation processor within the Maven Comp
173199
</compilerArgs>
174200
</configuration>
175201
</plugin>
176-
</plugins>
177-
</build>
178-
```
179202

180-
### Add the ObjectBox Maven plugin
181-
182-
The ObjectBox Maven Plugin is available from [Maven Central](https://central.sonatype.com/artifact/io.objectbox/objectbox-maven-plugin).
183-
184-
Add it to your `pom.xml`:
185-
186-
```xml
187-
<build>
188-
<plugins>
203+
<!--
204+
The ObjectBox Maven plugin: adds a objectbox:transform goal which transforms class files
205+
(byte-code) as part of the compile lifecycle phase.
206+
This is required to make relations easier to use.
207+
-->
189208
<plugin>
190209
<groupId>io.objectbox</groupId>
191210
<artifactId>objectbox-maven-plugin</artifactId>
@@ -198,15 +217,15 @@ Add it to your `pom.xml`:
198217
</execution>
199218
</executions>
200219
</plugin>
220+
201221
</plugins>
202222
</build>
203223
```
204224

205-
Source files will now be transformed as part of the `compile` lifecycle step to make [relations
206-
easier to use](https://docs.objectbox.io/relations#initialization-magic).
225+
> [!NOTE]
226+
> The Maven plugin transforms source files as part of the `compile` lifecycle step to make
227+
> [relations easier to use](https://docs.objectbox.io/relations#initialization-magic).
207228
208-
🎉 Done! See the [pom.xml of this example](pom.xml) for a working configuration or continue with the
209-
Getting Started page linked below.
229+
🎉 Done! See the [pom.xml of this example](pom.xml) for a working configuration or:
210230

211-
## Links
212-
- [Getting Started with ObjectBox](https://docs.objectbox.io/getting-started)
231+
➡️ Continue with [Getting Started with ObjectBox](https://docs.objectbox.io/getting-started).

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /