New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiled classes have missing package declaration. #37
Comments
No, rocker definitely creates package names. You are most definitely You should set output directory & template directory. -Joe On Tue, Sep 20, 2016 at 12:51 PM, joselightware notifications@github.com
|
If you send me your project structure and what you're setting the config to E.g. src/main/resources --> the package name detection would start from On Tue, Sep 20, 2016 at 1:17 PM, Joe Lauer joe@lauer.bz wrote:
|
Thanks for your quick reply, yes indeed I'm using gradle although in a different way as explained on my gradle post. Here is what I'm doing:
with the following template inside the template folder
When I call my compileRockerTemplates task templates get compiled as expected
The only problem is that the generated TestTemplate.java lacks the package declaration, if I manually add it everything works as expected, I was considering to add it myself on the compileRockerTemplates method modifying the files but maby as you point out I'm missing something that I should intialize on JavaGeneratorMain Many thanks for your help and advise. |
Simple fix. The base template directory is base dir where the package is rockerTemplateDirectory = project.projectDir.toString() + Or to be a java package of 'com.joe.view.template' then: rockerTemplateDirectory = project.projectDir.toString() + '/src/main/java' However, I'm not familiar with gradle, but I'm guessing there's a The class directory is definitely wrong. That should be set to the On Tue, Sep 20, 2016 at 2:15 PM, joselightware notifications@github.com
|
Nice, I solved the issue with your advise. so in my case i'll place the templates on "src/main/resources/com/jo" I achive this with the following configuration.
I placed the rocker-compiler.conf on the project root since I'm on a web project and theres no target, the only option to place it where compiled classes are would be to place it on "src/main/webapp/WEB-INF" but I'm not sure why is the rocker-compiler.conf file needed on a web project. Thank you very much for your help, this issue is closed for me, hope it helps other gradlers out there. |
Great. Sounds like a nice solution. Any interest in submitting a PR for the README.md that shows how to use Rocker generator from Gradle? |
Sure if not a PR ill PM you the code ^_^, just need to fix the other issue#36 with BindingRockerModel to make sure everything is working. |
I've uploaded a working rocker build.gradle to issue#33 with a downloadable example project, so this can serve as groundwork for a future gralde-rocker-plugin and readme documentation. |
Compiled templates create java files that lacks the package declaration on the first line, this causes issues on several IDE's and compile environments.
At least a property to enable package inclusion/exclusion should be added to fit all project needs.
The text was updated successfully, but these errors were encountered: