townsfolk / gradle-templates Goto Github PK
View Code? Open in Web Editor NEWA gradle project templates plugin
License: Apache License 2.0
A gradle project templates plugin
License: Apache License 2.0
See also #20 #21
The method request an int
as defaultValue value
static int promptOptions(String message, int defaultValue, List options = [])
then in readLine
, it returns the int
return System.console().readLine(_message) ?: defaultValue
and then tries to call parseInt
on it
int choice = Integer.parseInt(readLine(consoleMessage, defaultValue))
Finally you end up with that kind of error :
No signature of method: static java.lang.Integer.parseInt() is applicable for argument types: (java.lang.Integer) values: [0]
Do templates relate at all to gradle's setupBuild --type option? (other than offering many more templates)
The issue comes from there in src/main/groovy/templates/TemplatesPlugin.groovy
String consoleMessage = "${inputPrompt} ${message}"
And then when calling readLine(String message, def defaultValue = null)
with previous consoleMessage
String _message = "$inputPrompt $message " + (defaultValue ? "[$defaultValue] " : "")
I'm asking because I'm having a project which uses this and we're having issues when we tried to use this with gradle 3.1. I'm willing to fix that but I need to know if anyone will review/merge/release it.
For tasks that create a class or classes, appropriate unit tests should also (optionally?) be created.
I don't have enough project privileges to create a GitHub pages for the project. Please create the main template and I can fill in the details - Thanks.
I want to create Dynamic Webproject using Gradle Template plugin. how to do it?
In some use cases we may only want the core templates functionality without any of the technology-specific derivatives. It would be nice to be able to just pull in the core as a plugin without the other parts - similar to how you could just install the java-templates
plugin now.
My build.gradle looks like this
buildscript {
repositories {
maven {
url 'http://dl.bintray.com/cjstehno/public'
}
}
dependencies {
classpath 'gradle-templates:gradle-templates:1.5'
}
}
apply plugin:'templates'
If I execute gradle createJavaProject, the following error occurs:
A problem occurred evaluating root project 'template-interfaces'.
> Failed to apply plugin [class 'templates.GroovyTemplatesPlugin']
> Could not create task of type 'CreateGroovyClassTask'.
Hi,
I tried installing the plugin using the binary option and I was able to run gradle createJavaProject successfully.
I tried the sample build which is used to create a simple custom project structure .
When I run gradle createMyProject , i get the below error.
gradle createMyProject
:createMyProject FAILED
FAILURE: Build failed with an exception.
Where:
Build file '/Users//Desktop/sample_projects/try_out_gradle_templates/build.gradle' line: 5
What went wrong:
Execution failed for task ':createMyProject'.
Could not find property 'TemplatesPlugin' on task ':createMyProject'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 16.004 secs
Please guide.
Hi,
I am trying to initialize a Scala Project within a directory.
Gradle excetution of 'initScalaProject' fails with an exception.
I have provided the stack execution and results below:
$ gradle initScalaProject
Building > :initScalaProject
??> Scala Version: [2.9.0] y
??> Use fast compiler? (Y|n) y
:initScalaProject FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':initScalaProject'.
Could not find property 'projectGroup' on root project 'SimpleScalaProject'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 12.592 secs
Keep an eye on the built-in Gradle init plugin (http://www.gradle.org/docs/current/userguide/build_init_plugin.html), which is currently incubating (1.11) - it may make the templates-plugin obsolete.
Any chance you could convert this project to a more standardized license like Apache 2 or something? What you have is flexible enough but being non-standard it may deter some users.
I would be willing to make the conversion and submit a pull request.
I'm having trouble installing this plugin from source. Are the directions still accurate? I'm on gradle 1.3. I forked and cloned the repo, then ran gradle build which ran successfully. Then I created a new folder with a blank build.gradle and added the following lines:
apply plugin: 'groovy'
apply from: 'file:///Users/kboon/Documents/workspace/gradle-templates/installation/apply-local.groovy'
I also copied templates-1.3.jar into my gradlehome/lib directory. The error I am seeing is:
AILURE: Build failed with an exception.
Where:
Build file '/Users/kboon/Documents/workspace/gradle-templates-test/build.gradle' line: 2
What went wrong:
A problem occurred evaluating root project 'gradle-templates-test'.
Could not resolve all dependencies for configuration 'classpath'.
Could not find group:gradle-templates, module:templates, version:unspecified.
Required by:
unspecified:unspecified:unspecified
This is the first time I've tried to install a gradle plugin from source so this could just be my fault. Thanks for any help.
The gradle wrapper is becoming more popular, need to add options to include it in the build file templates.
I don't have permissions to add commit hooks to the repository so I cannot setup a Drone.io build. I will see if there is a work-around otherwise I may need some admin assistance.
Would be interesting/useful to allow templates (or partial templates) to be merged to create a project or fileset (or added to an existing project)... say I want to create a java project based on maven you could apply the java templates and maven templates, and when I want a java+gradle project you could apply the java and gradle templates.
Not sure how to do this yet, but it could be a nice addition. This may already exist functionally so perhaps only documentation is needed.
Same root cause as #20
if (defaultValue) {
consoleMessage += "${inputPrompt} [${defaultValue}] "
} else {
consoleMessage += "${inputPrompt} "
}
and again in readLine(String message, def defaultValue = null)
with the previous consoleMessage
String _message = "$inputPrompt $message " + (defaultValue ? "[$defaultValue] " : "")
It would be useful to provide template options to inject one of the more common licenses into the project rather than the empty file.
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.