Skip to content

Commit 96f4a6f

Browse files
authored
Merge pull request #18 from antkorwin/improve-documentation
Improve documentation
2 parents 217be64 + 655885d commit 96f4a6f

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

README.adoc

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,88 @@ You shouldn't write too much code inside string literals because it is too diffi
159159

160160
## Getting started
161161

162+
### Maven
163+
162164
You need to add the following dependency:
163165

164166
[source,xml]
165167
----
166168
<dependency>
167169
<groupId>com.antkorwin</groupId>
168170
<artifactId>better-strings</artifactId>
169-
<version>0.4</version>
171+
<version>0.5</version>
170172
</dependency>
171173
----
172174

173175
And you can use string interpolation anywhere in your code.
174176

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+
175244
## How to turn-off string interpolation
176245

177246
To skip the string interpolation for class, method or field you can use the `@DisabledStringInterpolation` annotation:
171 KB
Loading

documentation/test-runner.png

94 KB
Loading

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<groupId>com.antkorwin</groupId>
66
<artifactId>better-strings</artifactId>
77
<packaging>jar</packaging>
8-
<version>0.5-SNAPSHOT</version>
8+
<version>0.5</version>
99

1010
<!-- region Info -->
1111
<name>BetterStrings Java Plugin</name>

0 commit comments

Comments
 (0)