orctom / gradle-archetype-plugin Goto Github PK
View Code? Open in Web Editor NEWGradle plugin that creates projects from your own cookiecutter
License: Apache License 2.0
Gradle plugin that creates projects from your own cookiecutter
License: Apache License 2.0
I used this with a local build and found out, that 1.4.6 is not downloaded via gradle. 1.4.5 is working, so I assume it is not published so short after release.
This is the Error:
FAILURE: Build failed with an exception.
Could not resolve all dependencies for configuration ':classpath'.
Could not find gradle.plugin.com.orctom.gradle:gradle-archetype-plugin:1.4.6.
Searched in the following locations:
https://plugins.gradle.org/m2/gradle/plugin/com/orctom/gradle/gradle-archetype-plugin/1.4.6/gradle-archetype-plugin-1.4.6.pom
https://plugins.gradle.org/m2/gradle/plugin/com/orctom/gradle/gradle-archetype-plugin/1.4.6/gradle-archetype-plugin-1.4.6.jar
Required by:
:temp:unspecified
BUILD FAILED
I'm trying to specify a value for a custom variable projectPackageName
via a bash script. Below is the command i'm invoking. I keep getting No such property: projectPackageName for class: groovy.lang.Binding
gradle --debug -b build.gradle.kts cleanArch generate -Dtarget=$path -Dgroup=com.vividseats -Dname=$name -Dversion=$version -DprojectPackageName=$projectPackageName
I would like to create a GAE project template, but I use and gradle ReplaceTokens to replace some of the the deployment params in the appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>@appName@</application>
<version>@appVersion@</version>
<module>serviceModule</module>
<runtime>java8</runtime>
@scalling@
<sessions-enabled>true</sessions-enabled>
<threadsafe>true</threadsafe>
<precompilation-enabled>@precompilationEnabled@</precompilation-enabled>
</appengine-web-app>
I change the module tag to
<module>@gaemodule@</module>
and I would like to the generator to set only this param.
Unfortunately this is not possible at this time. The generator requres all of the params values to be provided. As a workaround I added all of the other prams in the gradle.properties
systemProp.com.orctom.gradle.archetype.binding.appName=@appName@
systemProp.com.orctom.gradle.archetype.binding.appVersion=@appVersion@
systemProp.com.orctom.gradle.archetype.binding.scalling=@scalling@
systemProp.com.orctom.gradle.archetype.binding.precompilationEnabled=@precompilationEnabled@
I think it would be better if the generator replaces only the matching param, and if there is no value, then the params should not be replaced. Also it takes me long time to figure out what is actually cause the problem on this exact file
Hello,
I have noticed that "com.orctom.archetype" version "1.4.7" changes the content of a template file (*.java or *.gradle) which is outside of a defined binding. As soon as the file contains "\\" (2 backslashes) it will be replace into "\" (1 backslash).
For example if you would need this in a gradle file:
includeGroupByRegex="my\\.company\\..*"
The output will be:
includeGroupByRegex="my\.company\..*"
A workaround is to double it ;-)
includeGroupByRegex="my\\\\.company\\\\..*"
But this is quite annoying. Can you please fix it.
I am using widows 10, so I don't know if this is an os-related problem.
Best wishes
For example
@Arround("bean(@var@RestTemplate)")
GStringTemplateScript3782.groovy: 52: expecting anything but ''\n''; got it anyway @ line 52, column 82.
{var}RestTemplate)")
I can't find any instruction for generating code from a remote repository like maven archetype plugin, does the gradle-archetype-plugin support this feature?
I had an issue where custom properties were not getting resolved. It turned out I had to use systemProp.com.orctom.gradle.archetype.binding.CUSTOM_PROPERTY to be able to set them. Can you update the documentation please?
Dear orctom Team,
thank you for this awesome plugin!
Is it possible to publish version 2.0.0 and later to gradle / maven public repositories. The last published version is 1.4.8 from 11. 2019:
Cheers,
Davor
This line doesnt look like it does what it is expected to do, could be changed to something like :
binding << bindingsToPrompt.collectEntries { key, defaultValue ->
[(key): this.class.getParam(key, "Please enter ${key}", defaultValue) ]
}
This weird behavior happens if there any empty line in the .nontemplates file:
**/*.jar
**/*.bat
**/*.sh
**/*.zip
**/*.gz
**/*.xz
**/*.tar
**/*.7z
gradle/
.gradle/
gradlew
gradlew.bat
You can reproduce the bug simply by modifying the .nontemplates and run command against your sample project:
$ gradle cleanArch generate
$ cat generated/settings.gradle
include "@projectName@-model", "@projectName@-web"
// @packagePath@
// @groupPath@/@namePath@
// @name.capitalize()@
// @new Date()@
Circumstances are I want to add more patterns to .nontemplates, and use empty(or blank) lines to make it easier for grouping purpose. I came across this problem just in that case, and finally find the bug. Either this behavior should be mentioned in the README or be fixed.
Right now, when some token cannot be expanded, only an ERROR is logged:
This might easily be missed by the users, producing a file where no tokens are expanded (not just the missing ones). It would be cool, if:
(A) it would be configurable to fail the whole task if something fails to resolve or
(B) have a way to retrieve the failures after the generate
task has finished, for example on the task itself as a new property.
For (A), I guess it could be similar to the existing failIfFileExist
, e.g. adding failIfResolvingFails
, default to false
to keep working the same as before.
For (B), I'd ideally love to use something like:
generate {
dependsOn clean, validateArchetype, loadArchetypeMetadataFile, loadArchetypeVarFile
bindingProcessor = ...
doLast {
// resolveFailures might have e.g. the type Map<File, String>, which would be mapping of <file> -> "the exception message" as logged right now in the catch block
if (!resolveFailures.isEmpty()) {
throw new RuntimeException("Variables in some files could not be resolved, please check your template files / bindings: ${resolveFailures}")
}
}
}
I clone the project and navigate to /gradle-archetype-plugin/src/test/resources/sample.
When I execute 'gradle cleanArch generate -i' command, I receive the error:
Initialized native services in: /home/daniloalexandre/.gradle/native
The client will now receive all logging from the daemon (pid: 2974). The daemon log file: /home/daniloalexandre/.gradle/daemon/7.0.1/daemon-2974.out.log
Starting 2nd build in daemon [uptime: 40 mins 16.265 secs, performance: 100%, non-heap usage: 25% of 256 MiB]
Using 4 worker leases.
Now considering [/home/daniloalexandre/examples/gradle-archetype-plugin/src/test/resources/sample, /home/daniloalexandre/examples/MyService/techne] as hierarchies to watch
Watching the file system is enabled if available
Starting Build
Settings evaluated using settings file '/home/daniloalexandre/examples/gradle-archetype-plugin/src/test/resources/sample/settings.gradle'.
Projects loaded. Root project using build file '/home/daniloalexandre/examples/gradle-archetype-plugin/src/test/resources/sample/build.gradle'.
Included projects: [root project 'temp']
> Configure project :
Evaluating root project 'temp' using build file '/home/daniloalexandre/examples/gradle-archetype-plugin/src/test/resources/sample/build.gradle'.
All projects evaluated.
Selected primary task 'cleanArchetype' from project :
Selected primary task 'generate' from project :
Tasks to be executed: [task ':cleanArchetype', task ':generate']
Tasks that were excluded: []
:cleanArchetype (Thread[Execution worker for ':' Thread 2,5,main]) started.
> Task :cleanArchetype FAILED
:cleanArchetype (Thread[Execution worker for ':' Thread 2,5,main]) completed. Took 0.019 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':cleanArchetype' (type 'ArchetypeCleanTask').
- Type 'com.orctom.gradle.archetype.ArchetypeCleanTask' property 'description' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.1/userguide/validation_problems.html#missing_annotation for more details about this problem.
- Type 'com.orctom.gradle.archetype.ArchetypeCleanTask' property 'group' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.1/userguide/validation_problems.html#missing_annotation for more details about this problem.
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
1 actionable task: 1 executed
Watching 0 directories to track changes
I'm using gradle 7.0.1:
------------------------------------------------------------
Gradle 7.0.1
------------------------------------------------------------
Build time: 2021-05-10 16:08:58 UTC
Revision: 67e618faef187783dadd03a34fdab9dc71b85b19
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 11.0.11 (Ubuntu 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OS: Linux 5.4.72-microsoft-standard-WSL2 amd64
Maybe this problem is related to #32
Hello ...
When running over files that contain \n or \r, the generator automatically converts them into actual new lines.
This is unwanted behaviour and can break files that depend on this syntax.
examples:
"description": "Contact Support:\n Name: NAME\n Email: [email protected]"
is replaced with:
"description": "Contact Support:
Name: NAME
Email: [email protected]"
The could be somehow related to #34
Submitted PR #10 for allowing more than just letter characters to be included in replace operation. This allows full expressions to be passed on to the GStringTemplateEngine. This lets a user capitalize class names, add dates in Javadoc templates, and other useful features
@PostMapping
public ResponseEntity createProduct(** @requestbody @Valid ProductDetail product**) {
log.info("REST[createProduct] Rx[{}]", toStringHelper.asString(product));
ProductDetail productDetail = productDetailService.create(product);
log.info("REST[createProduct] Tx[{}]", toStringHelper.asString(productDetail));
return new ResponseEntity<>(productDetail, HttpStatus.OK);
}
In the above code snippet , @requestbody and @Valid are two annotations given to ProductDetail parameter . If we run the cleanArch generate archetype task , we get the following error :
Failed to resolve variables in: 'C:\harish\projects\archetype\src\main\resources\templates\src\main\java_packagePath_\model\web\rest\ProductDetailRestRestController.java]
No such property: RequestBody for class: groovy.lang.Binding
@orctom : Can you suggest any solution / configuration for the same if we are missing something? . If its an outstanding issue , is there an ETA for the fix ?
* What went wrong:
A problem occurred evaluating root project 'gradle-archetypes'.
> Failed to apply plugin [id 'com.orctom.archetype']
> Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed.
I think this error message is related to below description at Gradle 3.0 Release note (Changes to previously deprecated APIs);
Declaring custom check, clean, build or assemble tasks is not allowed anymore when using the lifecycle plugin.
More of a question than an issue, but is there anyway to escape $.
In my files with ${variable} the $ is being replaced by DOLLAR
Hi,
I think the variable mapping is not correct,
When I put __namePath__
as a directory, it produces:
dummy-app, instead of the expected dummy/app
Similarly, when I put __packagePath__
as a directory, it produces:
com.xxx.yyy/dummy-app instead of com/xxx/yyy/dummy/app
Oddly, __groupPath__
seems to work as intended.
I'm wondering if it would be possible to add these standard variables in (any suggestions welcome):
Starting strings:
name | description | type | sample |
---|---|---|---|
group | project.group | string | com.xxx.yyy |
name | project.name | string | dummy-app |
version | project.version | string | 1.0-SNAPSHOT |
Generates the following:
name | description | type | sample |
---|---|---|---|
packageName | name replacing '-' with '.' | string | dummy.app |
nameFolderPath | name replacing '.' with '/' | directory | dummy/app |
groupFolderPath | group replacing non-characters with '/' | directory | com/xxx/yyy |
fullPackageName | group + name replacing non-characters with '.' | string | com.xxx.yyy.dummy.app |
fullPackagePath | replaced '.' with '/' in packageName | directory | com/xxx/yyy/dummy/app |
This is for when I create a new project, I want to use a name like simple-service
. Normally I'd be able to just use fullPackagePath
but sometimes, I want to break it up like ${groupFolderPath}/outside/module/${nameFolderPath}
instead. The package ...
line in the code has to be created with: ${group}.outside.module.${packageName}
which is impossible to generate as is currently.
I can try adding these myself but I don't want to change any variable names from what is already there so I figure I should let you handle it. :P
Fyi, this is a great project. Thanks for it!!
The following error occurs:
> Task :cleanupGeneratedApplication UP-TO-DATE
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':generate' (type 'ArchetypeGenerateTask').
- Type 'com.orctom.gradle.archetype.ArchetypeGenerateTask' property 'description' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
- Type 'com.orctom.gradle.archetype.ArchetypeGenerateTask' property 'group' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.0.2/userguide/validation_problems.html#missing_annotation for more details about this problem.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
BUILD FAILED in 950ms
9 actionable tasks: 8 executed, 1 up-to-date
The cleanArchetype
task also has this problem.
using gradle-archetype-plugin with windows 10
, got this error 😢
* What went wrong:
Execution failed for task ':generate'.
> Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
GStringTemplateScript3.groovy: 2: unexpected char: '\' @ line 2, column 50.
{ return { out -> out << """D:\git\gradl
^
1 error
* Try:
Run with --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':generate'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:84)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:236)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.execute(DefaultTaskGraphExecuter.java:228)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:61)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:228)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:77)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:58)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:256)
at org.gradle.initialization.DefaultGradleLauncher$RunTasksAction.execute(DefaultGradleLauncher.java:253)
at org.gradle.internal.Transformers$4.transform(Transformers.java:169)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:106)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:56)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:175)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:119)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:102)
at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:71)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:49)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:49)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:31)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:46)
Caused by: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
GStringTemplateScript3.groovy: 2: unexpected char: '\' @ line 2, column 50.
{ return { out -> out << """D:\git\gradl
^
1 error
at com.orctom.gradle.archetype.util.FileUtils.getTargetFile(FileUtils.groovy:111)
at com.orctom.gradle.archetype.util.FileUtils$_generate_closure3.doCall(FileUtils.groovy:77)
at com.orctom.gradle.archetype.util.FileUtils.generate(FileUtils.groovy:76)
at com.orctom.gradle.archetype.util.FileUtils$generate.call(Unknown Source)
at com.orctom.gradle.archetype.ArchetypeGenerateTask.create(ArchetypeGenerateTask.groovy:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:141)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:123)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:632)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:615)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:95)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:76)
... 70 more
If I have empty directories in my template, these are not included in the output to the generated directory.
e.g. with the following template structure:
src/main/resources/templates/src/main/resources/common/log4j2.xml
src/main/resources/templates/src/main/resources/dev
the produced output from calling > gradlew generate -i
only includes:
generated/src/main/resources/common/log4j2.xml
The 'dev' directory is missing from the generated output.
Hi,
I have a problem with Dockerfile generation. Dockerfile has no extension by convention, but this plugin treats files without extensions like directories. Is there any chance to fix it?
The problem is in this line of code (FileUtils:101):
static boolean isDir(File file) {
!file.name.contains('.')
}
I could make some workaround/fix but I'm not a groovy master ;)
@packageName@ variables not being substituted for annotations.
@ComponentScan("@packageName") public class ExampleConfig{ }
I see this error in the console.
GStringTemplateScript78500.groovy: 18: Unexpected character: '"' @ line 18, column 9. ${ComponentScan("}packageName@\")
Can someone guide me how to resolved this?
I would say it is quite common to have a human readable projectName
like "This is my project", which may also end up in a manifest.mf file and an artifact ID name
property like "org.my.project".
The plugin should ask for the projectName
as well in interactive mode. Might be optional.
Currently, the replacements (bindings) for the generation must be specified via properties or entered by the user. If they come from the user, there's no way to create additional bindings based on the value of an existing binding.
As a simple example, I can currently do things like @name.capitalize()@
, but if I need to perform more complicated transformation (or I need to use them in file names), it becomes cumbersome.
If the generate
task supported a mechanism to allow the consuming project to modify the bindings just prior to generation (after all the current variable resolution has been performed), that would greatly simplify common transformations. Using the example above, I could add a capitalizedName
binding and then reference that within all the places needed.
I have worked up a simple implementation that allows the task to be configured with a bindingProcessor
that is just a closure accepting the binding map as an argument. The closure can then update the binding map as desired. The closure is invoked just prior to starting the generation (i.e., the call to FileUtils.generate
. I can provide a Pull Request for this modification if you feel it would make a good addition to the project.
When I run the plugin with Gradle 6.0.1 (./gradlew --warnings-mode all cleanArchetype), I receive the following warning:
Task :cleanArchetype
Property 'description' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Property 'group' is not annotated with an input or output annotation. This behaviour has been deprecated and is scheduled to be removed in Gradle 7.0.
Hello ...
When running over files that contain \n or \r, the generator automatically converts them into actual new lines.
This is unwanted behaviour and can break files that depend on this syntax.
examples:
"description": "Contact Support:\n Name: NAME\n Email: [email protected]"
is replaced with:
"description": "Contact Support:
Name: TEAM NAME
Email: [email protected]"
The could be somehow related to #34
Items in my .nontemplates file seem to be ignored, as the plugin attempts to interpret files, including files in the gradle directory as templates. Details are below.
environment:
$ gradle --version
------------------------------------------------------------
Gradle 5.6.3
------------------------------------------------------------
Build time: 2019-10-18 00:28:36 UTC
Revision: bd168bbf5d152c479186a897f2cea494b7875d13
Kotlin: 1.3.41
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
OS: Linux 5.2.11-100.fc29.x86_64 amd64
templates directory
$ ls -altr src/main/resources/templates/
total 16
drwxrwxr-x. 3 cgardner cgardner 4096 Nov 6 23:20 ..
drwxrwxr-x. 8 cgardner cgardner 4096 Nov 7 21:24 __projectName__
-rw-rw-r--. 1 cgardner cgardner 116 Nov 7 21:44 .nontemplates
drwxrwxr-x. 3 cgardner cgardner 4096 Nov 7 21:44 .
.nontemplates file
$ cat src/main/resources/templates/.nontemplates
# comments
**/*.jar
**/*.bat
**/*.sh
**/*.zip
**/*.gz
**/*.xz
**/*.tar
**/*.7z
gradle/
.gradle/
gradlew
gradlew.bat
Output
<======-------> 50% EXECUTING [46s]
Variables:
group ='group'
groupId ='group'
name ='project'
projectName ='project'
artifactId ='project'
version ='1.0-SNAPSHOT'
project.version ='1.0-SNAPSHOT'
namePackage ='project'
namePath ='project'
groupPath ='group'
packagePath ='group/project'
packageName ='group.project'
Using template in: /home/cgardner/git/gradle-clean-arch/src/main/resources/templates
Using non-template list in file: /home/cgardner/git/gradle-clean-arch/src/main/resources/templates/.nontemplates
Failed to resolve variables in: '/home/cgardner/git/gradle-clean-arch/src/main/resources/templates/__projectName__/.gradle/5.6.4/javaCompile/classAnalysis.bin]
Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed:
GStringTemplateScript792.groovy: 4: unexpected char: 0x1E @ line 4, column 53.
���ZE���K������������${���I
Using version 1.4.8.
Custom properties that are being loaded via bindingsToPrompt are not being resolved in template files.
Hey guys,
I think it's great that you're adding a much-needed functionality to gradle 😄
Sadly, I could not figure out how to create my very own template using this project, or how to let others use both in order to generate sample (archetype) projects in their local machines.
thanks
I am trying to run the sample project and following the instructions gives me:
Could not find com.orctom.gradle:gradle-archetype-plugin:1.4.6.3.
The plugin doesn't appear to have been released to https://jcenter.bintray.com/com/orctom/ and therefore can't be pulled into the project as a buildscript dependency.
Plugin is also not available at https://repo1.maven.org/maven2/com/orctom/
Am I missing something here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.