Intellij does not recognize lombok.config when building - intellij-lombok-plugin

I opened the restbucks project with Intellij. I have lombok plugin installed, annotation processing enabled. I am using javac compiler in Intellij settings. I have lombok.config in project root like in git repository, I also tried copying it to src/main/java and src/main/resources but no matter what I try, when I build the project with Intellij, after posting an order, I get:
Argument #0 of constructor [constructor for
org.springsource.restbucks.order.Order, annotations: {interface
com.fasterxml.jackson.annotation.JsonCreator=#com.fasterxml.jackson.annotation.JsonCreator(mode=DEFAULT)}]
has no property name annotation; must have name when
multiple-parameter constructor annotated as Creator
Seems like lombok.anyConstructor.suppressConstructorProperties=true has no effect. When I build with maven then it works fine.
When I delete the lombok.config file, Intellij starts showing errors all over the project so the file seems to be recognized by Intellij afterall. But the build doesn't run as expected as posting to orders fails as mentioned above. Does anyone know what's going on here?

Lombok plugin does support lombok.config file.
The lombok.anyConstructor.suppressConstructorProperties is deprecated as per in Lombok doc
BREAKING CHANGE: lombok config key lombok.anyConstructor.suppressConstructorProperties is now deprecated and defaults to true, that is, by default lombok no longer automatically generates #ConstructorProperties annotations. New config key lombok.anyConstructor.addConstructorProperties now exist; set it to true if you want the old behavior. Oracle more or less broke this annotation with the release of JDK9, necessitating this breaking change.
Use the new lombok.anyConstructor.addConstructorProperties in the lombok.config located in the root folder and
also, perform a clean install and then should be fine.

Related

Folders and files in .apt_generated not automatically created using the plugin id "net.ltgt.apt" version "0.11 (JHipster/Mapstruct)"

I created a new JHipster project (with version 4.8.1) and I imported it as Gradle project into Spring Tool Suite 3.9.0.RELEASE
When I run the project, I have this message in the console:
> Consider defining a bean of type
> 'it.andrea.test.service.mapper.PersonaMapper' in your configuration.
I see that the folder .apt_generated is never created.
In the build.gradle file, I changed the plugin
id "net.ltgt.apt" version "0.11"
with
id "net.ltgt.apt" version "0.8"
and now it works.
Why?
Regards,
Andrea

JRebel - sync new gradle jars on classpath

Can jrebel detect a jar file has been added to maven/gradle and then automatically add it my libs folder and add it to the classpath?
For example I'm running IntelliJ and Jetty and I make a gradle change to add a new version of a jar dependency and then click "gradle refresh."
Can jrebel be set up to load that jar? Otherwise this requires a full restart which partially makes jrebel less useful.
The short answer is no.
JRebel works by reloading individual class files, but not whole JARs.
If you add a new dependency or update the version of an existing dependency then it won't get reloaded.
However, if this library you're updating or adding is your own internal library that you build yourself, then it is possible to reload the changes.
In that case you need to build a rebel.xml file into the root of that library jar and configure it to point to the build directory of the library.

I don't have gradle.build, why?

I am using Android-Studio to build my app. In order to add libraries, I need to edit build.gradle file but I don't see it anywhere. Even if I changed files-view from android to project and vice-versa .
Why don't I see/have build.gradle ?
Check in your git repository if it contains the build.gradle files.
If not, you can just add manually to your project.
You should have something like this:
root
|--app
|----build.gradle
|--build.gradle
|--settings.gradle
You can also create a new blank project and copy the build.gradle files into your existing project (of course in the app/build.gradle file you have to change the values and the dependencies).
With huge help from #JuLes (commentting on my question) I figure out how to solve it. Here is what I did:
I totally removed Android-Studio following this guidance, then ...
I installed Gradle from this link, then ...
I re-installed Android-Studio following this link:
I am gussing the main problem was that I didn't installed Gradle manually and hence Android-Studio was using some sort of Gradle-Wrapper to allow the application to run.
Now, finally I can edit build.gradle.
BIG THANKS TO: JuLie

Adding Jar dependency in gradle custom plugin

Assuming all my Gradle plugin user going to have a MYAPP_HOME sys variable set in there system
in MYAPP_HOME page i have a jar at $MYAPP_HOME/lib/mylib.jar
i am writing my own plugin....
I can find the MYAPP_HOME variable is set and fine the jar exists..
How can i add this jar dependency in my custom gradle plugin... ? when user runs my plugin say compileMyplugin my custom gradle plugin need to set the $MYAPP_HOME/lib/mylib.jar jar as compiler dependent
How to do this any one help me ?
The plugin just needs to do:
project.dependencies {
compile project.files("${System.getenv("MYAPP_HOME")}/lib/mylib.jar"))
}
PS: In general, I wouldn't recommend relying on an environment variable and the availability of a Jar on the local file system. Instead, I'd publish the Jar to an artifact repository or put it under source control.

Would JRebel work with this project setup?

we have a project where we use Maven to deploy to Tomcat on mvn clean install. I'm fairly new to Java development and finding it difficult to continually wait for install to complete to view changes. I use IntelliJ and I think the class files are only created during mvn install in the target directory.
Is it possible to use JRebel so when I save a file in IntelliJ the compiled class updates Tomcat immediately like they show on the JRebel video?
Thanks
IntelliJ saves the file automatically for you. All you need to do is to recompile the changed classes and these will be picked up by JRebel, given you have included rebel.xml configuration file into the deployed archive.

Resources