I have IntelliJ Ultimate 2019.2 installed with the latest Lombok plugin (0.25).
Furthermore, Lombok is enabled for my project (Preferences --> Other Settings --> Lombok Plugin) and the plugin installed.
Annotation Processing is also enabled.
My project uses Java11.
Everything works fine when I run my application via Gradle or run unit tests via ./gradlew test.
When I now configure to use IntelliJ IDEA tooling (Preferences --> Build, Executions, Deployment --> Built Tools --> Gradle --> Both 'Build an Run using:' and 'Run tests using:' set to 'IntelliJ IDEA') it stops working, my generated classes are not found.
I receive exceptions, that my constructors are not found, while they were found when I am using gradle
(no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
I've clicked on Refactor->Lombok->#Log and friends and IDEA started to compile the code.
Related
I am getting the following error when I try to run tests in IntelliJ (2019.1), Scala IntelliJ plugin v2019.1.8, with Scala 2.13:
Exception in thread "ScalaTest-dispatcher" java.lang.NoSuchMethodError: scala.collection.JavaConverters.seqAsJavaListConverter(Lscala/collection/Seq;)Lscala/collection/convert/Decorators$AsJava;
at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder.getOrdinalList(ParallelTreeBuilder.java:21)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder$SuiteTree.<init>(ParallelTreeBuilder.java:92)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.treeBuilder.ParallelTreeBuilder.initRun(ParallelTreeBuilder.java:261)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestReporterWithLocation.apply(ScalaTestReporterWithLocation.java:59)
at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10(DispatchReporter.scala:249)
at org.scalatest.DispatchReporter$Propagator.$anonfun$run$10$adapted(DispatchReporter.scala:248)
at scala.collection.immutable.List.foreach(List.scala:312)
at org.scalatest.DispatchReporter$Propagator.run(DispatchReporter.scala:248)
at java.lang.Thread.run(Thread.java:745)
The following are my Gradle dependencies:
dependencies {
implementation 'org.scala-lang:scala-library:2.13.0'
testImplementation 'org.scalatic:scalatic_2.13:3.0.8'
testImplementation 'org.scalatest:scalatest_2.13:3.0.8'
}
When I change the dependencies to Scala 2.12.x, the tests execute correctly in IntelliJ without error. What is going on here?
Update: This has been fixed in plugin version 2019.1.9.
It is possible IntelliJ Scala plugin needs to be updated for 2.13. Meanwhile try workaround by selecting the checkboxes Use sbt and Use UI with sbt under test's Edit configuration.... According to Dmitrii Naumenko:
This is fixed in the
2019.1 EAP #2019.1.8.21
2019.2 Nightly
Will be available soon in 2019.2 EAP and 2019.1 new Release
Regarding Gradle, try configuring to delegate to Gradle Test Runner
Remove exising ScalaTest runners
Go to Build, Execution, Deployment | Build Tools | Gradle | Runner
Select the checkbox Delegate IDE build/run actions to Gradle
Choose Gradle Test Runner
I have a multi-module project that uses maven. Is there a way I can point IntelliJ to maven target/ folder so when I start Debug it won't rebuild the project from scratch and re-upload a whole project via JRebel all over again.
Basically, use target/ as a build folder. Changing compile output path didn't work as I expected it to not compile classes that were compiled by mvn already.
The IntelliJ Run/Debug configurations can specify which actions happen before launching the application.
By default for say web applications, this would display
Build
Build x artifact
You may remove both entries if you are happy with building via maven before launching the application.
Regarding the JRebel side of it - it should certainly not be updating the classes on the second compile assuming nothing changed. The classes have their hashes checked before a reload. This is assuming maven and IntelliJ are using the default javac compiler. If either is configured to use ecj compiler, it's best to let JRebel only see classes built with the same compiler.
I'm trying to switch over to Gradle Kotlin DSL from vanilla Gradle for all my IntelliJ/Kotlin projects. This requires me to specify the distributionUrl property in a Gradle wrapper task of the build file. However whenever I create a Gradle project and choose the "default Gradle wrapper" option, IntelliJ automatically generates a vanilla Gradle version 4.0 (atleast as of right now) wrapper and builds the project using it. Not only does this install an unused Gradle distro on my machine and makes me manually have to recreate the build file and wrapper, but also Gradle 4.0 isn't compatible Java 9.
Is there any way to change what default Gradle wrapper/build file is generated by IntelliJ as I see no wrapper configuration options in the settings tab of the Gradle plugin?
So this is actually a requested feature (thanks to #y.bedrov for the info), but I've found a temporary workaround...
Instead of using the Gradle project creation wizard, you can import a custom buildscript via Import Project. This actually supports Kotlin DSL! However for that, you'll have to add a wrapper task in the buildscript and set the distributionUrl to one of the releases here.
Each time I attempt to create a new IntelliJ 14.1.4 project on Windows with Gradle integration I receive the following error during the 'Make' command when I have any Groovy source files included in the project...
Error:Cannot compile Groovy files: no Groovy library is defined for module 'GradleCommandLine'
I have tried:
Creating a Gradle project through the new project wizard in IntelliJ, choosing Groovy as a an 'Additional Library'
Creating a new Gradle project outside of IntelliJ using the gradle init --type groovy-library command, then opening IntelliJ which finds the gradle.build file and automatically links to the project
Converting an existing project that was working with the IvyIDEA plugin to a Gradle build
I have tried adding (made sure) my groovy-all library as a 'Global Library' within the project structure
Each of these gave me the same 'Cannot compile Groovy files' error.
What does work:
I can run the gradle war command which compiles correctly and I can deploy the build war to an application server (in my case Tomcat 7.0.47)
However in watching the Getting Started with Gradle in IntelliJ IDEA 13 (they do not have one for IntelliJ 14) demo video, they are able to just run the standard 'Make' and add the unexploded war as a build artifact.
Also had a colleague using the Mac version of IntelliJ 14.1.4 do the same 'I have tried' attempts above and he did not run into any issues. They even imported the same project I was having issues with and it was able to do the 'Make' without any changes to settings.
Pointing to local Gradle installation solved issue. There was an issue with a corporate proxy preventing the Gradle distribution from installing properly.
I'm working on multiple Gradle projects with internal and external dependencies, and so far I am happy that thanks to Gradle's dependency management I can modify a library project without affecting every application that uses the library.
When I need to modify a library project and test it using an application project that uses it, I need to do the following,
Modify the library project and commit to SCM
Trigger CI to build the library project and push it to my Gradle repository
Update the application project's build.properties to refer to the new version of library project
Iterate the above steps until everything works and there is no bug
So it became quite combersome now. Can I configure IntelliJ IDEA so that
All my Gradle projects are in one window, like the screenshot below, which is Twitter's Finagle imported using its pom.xml. Sadly IntelliJ's JetGradle plugin doesn't seem to understand Gradle subprojects.
When build.properties's dependencies are my subprojects, read dependency from local snapshot, otherwise download them from the Gradle repository
Thanks.
If you want to open all projects in a single IDEA window, you'll have to aggregate them into a multi-project build, at least until IDEA 13 hits the market. Before IDEA 13, it's better to use Gradle's IDEA integration. Once you have a multi-project build, all you need to do is to add allprojects { apply plugin: "idea" } to the root build script, run gradle (cleanIdea) idea, then open the generated IDEA project.
Currently in IntelliJ IDEA 2019.2 you can add the gradle subprojects like so
Open Gradle Tool Window via View > Tool Windows > Gradle menu
Click on "Link Gradle Project" button (the plus sign)
Select the build.gradle file corresponding to the subproject
Go to File > Project Structure > Modules > NameOfSubproject
Navigate to main/java and click on Mark as: Sources
Mark the main/resources as Resources
Restart IntelliJ IDEA
The sources of the subproject will be recognized by IntelliJ and you can use Navigate Class action for the classes in the subproject