@@ -159,19 +159,88 @@ You shouldn't write too much code inside string literals because it is too diffi
159
159
160
160
## Getting started
161
161
162
+ ### Maven
163
+
162
164
You need to add the following dependency:
163
165
164
166
[source,xml]
165
167
----
166
168
<dependency>
167
169
<groupId>com.antkorwin</groupId>
168
170
<artifactId>better-strings</artifactId>
169
- <version>0.4 </version>
171
+ <version>0.5 </version>
170
172
</dependency>
171
173
----
172
174
173
175
And you can use string interpolation anywhere in your code.
174
176
177
+ NOTE: if you use `maven-compiler-plugin` in your pom file then declare `better-string`
178
+ in the annotation processors configuration section:
179
+
180
+ [source, xml]
181
+ ----
182
+ <plugin>
183
+ <groupId>org.apache.maven.plugins</groupId>
184
+ <artifactId>maven-compiler-plugin</artifactId>
185
+ <version>3.5.1</version>
186
+ <configuration>
187
+ <annotationProcessorPaths>
188
+ <path>
189
+ <groupId>com.antkorwin</groupId>
190
+ <artifactId>better-strings</artifactId>
191
+ <version>${better-strings.version}</version>
192
+ </path>
193
+ </annotationProcessorPaths>
194
+ </configuration>
195
+ </plugin>
196
+ ----
197
+
198
+ You can read more about configuration of multiple annotation processors
199
+ for one project https://github.com/antkorwin/better-strings#6-how-to-use-with-other-annotation-processors[here].
200
+
201
+ ### Gradle
202
+
203
+ Add the following dependencies in your `build.gradle` file:
204
+
205
+ [source, gradle]
206
+ ----
207
+ compileOnly 'com.antkorwin:better-strings:0.4'
208
+ annotationProcessor 'com.antkorwin:better-strings:0.4'
209
+ ----
210
+
211
+ if you want use string interpolation for tests:
212
+
213
+ [source]
214
+ ----
215
+ testCompileOnly 'com.antkorwin:better-strings:0.4'
216
+ testAnnotationProcessor 'com.antkorwin:better-strings:0.4'
217
+ ----
218
+
219
+ Example of a simple application with gradle build:
220
+ https://github.com/antkorwin/better-strings-demo
221
+
222
+ ### Intellij IDEA with Gradle
223
+
224
+ Sometimes you can get into problems with gradle projects in IDEA,
225
+ an internal runner(in IDEA) may not execute our annotation processor.
226
+
227
+ You can read more about this problem here: https://stackoverflow.com/a/55605950
228
+
229
+ I suggest to turn on `enable annotation processing`
230
+
231
+ image::./documentation/enable-annotation-processors.png[enable annotation processing]
232
+
233
+ And select the `gradle test runner` in the Intellij IDEA settings.
234
+
235
+ image::./documentation/test-runner.png[gradle test runner]
236
+
237
+ ### Eclipse
238
+
239
+ Unfortunately, better-string doesn't work with Eclipse.
240
+ Eclipse uses its own java compiler and the annotation processing
241
+ with AST modification isn't work with them out of the box.
242
+
243
+
175
244
## How to turn-off string interpolation
176
245
177
246
To skip the string interpolation for class, method or field you can use the `@DisabledStringInterpolation` annotation:
0 commit comments