gaelyk / gradle-gaelyk-plugin

Gradle plugin that provides tasks for managing Gaelyk projects
Apache License 2.0
25 stars 5 forks source link

Handle Java keywords in folder names gracefully #33

Open garyhodgson opened 11 years ago

garyhodgson commented 11 years ago

Hi,

Whilst assembling my app I encountered a strange exception (stacktrace below) whilst running the gaelykPrecompileTemplate task. It appears to stem from a template folder being named "static". It can be recreated easily in the gaelyk template project by moving the index.gtpl into a sub-folder called static and running "gradlew assemble".

Also, and possibly related, it appears that packages starting with numbers throw the same exception, i.e. changing the template folder to 123 throws the same exception as above.

Cheers, Gary

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':gaelykPrecompileTemplate'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        ... snip ...
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:47)
Caused by: : Compilation Failed
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        ... snip ...
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60)
        ... 57 more
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\Tools\Cygwin\tmp\gtpl-staging--786316078\WEB-INF\pages\static\$gtpl$index.groovy: 1: expecting an identifier, found 'static' @ line 1, column 23.
   package web_inf.pages.static;out.print(""""""); include '/WEB-INF/includes/header.gtpl' ;
                         ^
1 error

        ... 74 more
musketyr commented 11 years ago

Hi,

The reason is obvious. Gaelyk compiles template to the packages according to their folders and static isn't allowed name for java packages.

I'll try to figure out if I can do any solution which can handle java keywords in folder names gracefully.

Cheers, Vladimír Dne 3.4.2013 23:26 "Gary Hodgson" notifications@github.com napsal(a):

Hi,

Whilst assembling my app I encountered a strange exception (stacktrace below) whilst running the gaelykPrecompileTemplate task. It appears to stem from a template folder being named "static". It can be recreated easily in the gaelyk template project by moving the index.gtpl into a sub-folder called static and running "gradlew assemble".

Also, and possibly related, it appears that packages starting with numbers throw the same exception, i.e. changing the template folder to 123 throws the same exception as above.

Cheers, Gary

  • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':gaelykPrecompileTemplate'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) ... snip ... at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:47) Caused by: : Compilation Failed at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) ... snip ... at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:60) ... 57 more Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: C:\Tools\Cygwin\tmp\gtpl-staging--786316078\WEB-INF\pages\static\$gtpl$index.groovy: 1: expecting an identifier, found 'static' @ line 1, column 23. package web_inf.pages.static;out.print(""""""); include '/WEB-INF/includes/header.gtpl' ; ^ 1 error

    ... 74 more

— Reply to this email directly or view it on GitHubhttps://github.com/gaelyk/gradle-gaelyk-plugin/issues/33 .

garyhodgson commented 11 years ago

I hadn't realised that keywords, nor numbers, were not allowed as package names in Java.

musketyr commented 11 years ago

No problem. I've updated the issue name that it will more correspond the desired state.