antkorwin / better-strings

Java String Interpolation Plugin
Apache License 2.0
98 stars 8 forks source link

Gradle #17

Closed raulest50 closed 4 years ago

raulest50 commented 4 years ago

Hi, first i want to thank you for this amazing work, i think many java developers would like this string interpolation feature available out of the box.

i have a java modular project with gradle, when i added to build.gradle => compile group: 'com.antkorwin', name: 'better-strings', version: '0.4' it did not work.

then i made a blank project with gradle but did not work either. afterwards i made a maven project and then it worked seamlessly.

dois it have to do with gradle or am i missing somenthing? thanks in advance for your time.

antkorwin commented 4 years ago

Hi, @raulest50 Thanks for the kind words!

I will check this build with gradle.

The previous version(0.3) doesn't work for you too?

raulest50 commented 4 years ago

i tried both .3 and .4 from https://mvnrepository.com/artifact/com.antkorwin/better-strings with modular and non modular gradle project.

antkorwin commented 4 years ago

I have made a simple gradle project: https://github.com/antkorwin/better-strings-demo

when I run gradle clean test from command line - all works fine, but if I use Intelij IDEA then I have a problem with annotation processors disabling.

I found a few topics about this problem at stack overflow: https://stackoverflow.com/questions/42441844/annotation-processor-in-intellij-and-gradle

turn on enable annotation processing and select the gradle test runner in the IDEA settings works fine for me.

Do you use IntelijIDEA? or something else?

raulest50 commented 4 years ago

thanks so much, it works now, im using netbeans, and created again a blank non modular gradle java project, then in the build.gradle i add in dependencies :

compile group: 'com.antkorwin', name: 'better-strings', version: '0.4' annotationProcessor 'com.antkorwin:better-strings:0.4'

just adding annotationProcessor as you did in your example make it work fine. perhaps this could be added to the readme in the "3. Getting started".

by the way, im posting the main.java and the gradle in case it may be of help for others. thanks again for the fast replay @antkorwin

Main.java:

package bstrings_test;

public class Main {

public static void main(String[] args) {

    var a = 3;
    var b = 4;
    System.out.println("${a} + ${b} = ${a+b}");

} 

}

build.gradle:

apply plugin: 'java' apply plugin: 'jacoco' apply plugin: 'application'

mainClassName = 'bstrings_test.Main'

repositories { jcenter() }

dependencies { testImplementation 'junit:junit:4.13'

// https://mvnrepository.com/artifact/com.antkorwin/better-strings
compile group: 'com.antkorwin', name: 'better-strings', version: '0.4'
annotationProcessor 'com.antkorwin:better-strings:0.4'

}

antkorwin commented 4 years ago

thanks for your feedback, I have updated documentation about the gradle build configuration and IntellijIdea settings.