@@ -56,7 +56,21 @@ specify the ID and URL of each repository in the `<repositories>` element:
56
56
57
57
## Set dependencies
58
58
59
- Kotlin has an extensive standard library that can be used in your applications.
59
+ To add a dependency on a library, include it in the ` <dependencies> ` element:
60
+
61
+ ``` xml
62
+ <dependencies >
63
+ <dependency >
64
+ <groupId >org.jetbrains.kotlinx</groupId >
65
+ <artifactId >kotlinx-serialization-json</artifactId >
66
+ <version >%serializationVersion%</version >
67
+ </dependency >
68
+ </dependencies >
69
+ ```
70
+
71
+ ### Dependency on the standard library
72
+
73
+ Kotlin has an extensive standard library that you can use in your applications.
60
74
To use the standard library in your project, add the following dependency to your ` pom.xml ` file:
61
75
62
76
``` xml
@@ -75,13 +89,56 @@ To use the standard library in your project, add the following dependency to you
75
89
> * 1.8, use ` kotlin-stdlib-jdk7 ` or ` kotlin-stdlib-jdk8 ` , respectively.
76
90
> * 1.2, use ` kotlin-stdlib-jre7 ` or ` kotlin-stdlib-jre8 ` , respectively.
77
91
>
78
- {style="note"}
92
+ {style="note"}
93
+
94
+ ### Dependencies on test libraries
79
95
80
96
If your project uses [ Kotlin reflection] ( https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect.full/index.html )
81
- or testing facilities, you need to add the corresponding dependencies as well .
82
- The artifact IDs are ` kotlin-reflect ` for the reflection library, and ` kotlin-test ` and ` kotlin-test-junit `
97
+ or testing frameworks, add the relevant dependencies.
98
+ Use ` kotlin-reflect ` for the reflection library, and ` kotlin-test ` and ` kotlin-test-junit `
83
99
for the testing libraries.
84
100
101
+ For example:
102
+
103
+ ``` xml
104
+ <dependencies >
105
+ <dependency >
106
+ <groupId >org.jetbrains.kotlin</groupId >
107
+ <artifactId >kotlin-reflect</artifactId >
108
+ <version >${kotlin.version}</version >
109
+ </dependency >
110
+ </dependencies >
111
+ ```
112
+
113
+ ### Dependency on a kotlinx library
114
+
115
+ Depending on the kotlinx library, you can either add the base artifact name or the name with a ` -jvm ` suffix. Refer to
116
+ the library's README file on [ klibs.io] ( https://klibs.io/ ) .
117
+
118
+ For example, to add a dependency on ` kotlinx.coroutines ` :
119
+
120
+ ``` xml
121
+ <dependencies >
122
+ <dependency >
123
+ <groupId >org.jetbrains.kotlinx</groupId >
124
+ <artifactId >kotlinx-coroutines-core</artifactId >
125
+ <version >%coroutinesVersion%</version >
126
+ </dependency >
127
+ </dependencies >
128
+ ```
129
+
130
+ To add a dependency on ` kotlinx-datetime ` :
131
+
132
+ ``` xml
133
+ <dependencies >
134
+ <dependency >
135
+ <groupId >org.jetbrains.kotlinx</groupId >
136
+ <artifactId >kotlinx-datetime-jvm</artifactId >
137
+ <version >%dateTimeVersion%</version >
138
+ </dependency >
139
+ </dependencies >
140
+ ```
141
+
85
142
## Compile Kotlin-only source code
86
143
87
144
To compile source code, specify the source directories in the ` <build> ` tag:
0 commit comments