I’m running a Spring Boot application and I’ve found the QueryDSL library very useful for simplifying the code for this project. There is a QueryDSL library that a developer can use in a project to generate the necessary files to leverage the QueryDSL library. The docs are not very good explaining how this works in Gradle, so I’ve had to piece together from other examples what works, but still haven’t gotten Spring Boot to play nicely with the QueryDSL gradle helper, so I’m reaching out here while I dig into the source code of
com.mysema.querydsl:querydsl-apt:3.6.3:jpa
to determine why it might be interfering with Spring Boot being able to run. The updates required in the build.gradle file to get the QueryDSL files generated are as follows
This makes the build task happy, but I cannot get bootRun to run successfully with the above mix of settings, it fails with
:mytestproj:findMainClass
Error: Could not find or load main class com.awarepoint.networkconfig.Application
Has anyone run across this? Does anyone have deep enough knowledge to be able to see what I might be doing wrong for Spring Boot’s plugin to not be happy with the above gradle code?
Wish I knew a bit more about Gradle to know why these are different, if you’ve got an inkling, would love to hear it for my own edification. This fixed the problem I’m now able to build and bootRun my Spring Boot application
In dependencies do compile("com.mysema.querydsl:querydsl-apt:3.7.4:jpa") The “jpa” in the end ensures that JPAAnnotationProcessor is run (Ref SO Answer). For me by default gradle put the generated sources in “build” directory along with the classes in order to change that the javac provies a “-s” option which specifies the destination directory for generated sources (How cool is that? - Javac Docs)