Details
-
Type:
New Feature
-
Status:
Resolved
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.7-rc-1
Description
Please see http://gradle.1045684.n5.nabble.com/Gradle-first-steps-and-create-project-td3315373.html
It would be good to have some way of conveniently creating a skeleton project (similar to the way "grails create-app" works, for example).
This would create the directory structure and maybe an example "HelloWorld" app for the user to customise.
You'd probably need separate options for Java, Groovy and Scala programs (the link above mentions some options).
The Script below will create the src file structure for a new project based on the used plugins.
(Tested with gradle-1.0-milestone1)
apply plugin: 'java' apply plugin: 'groovy' apply plugin: 'scala' task initProjectStructure () << { project.sourceSets.all*.allSource.sourceTrees.srcDirs.flatten().each { dir -> dir.mkdirs() } }task initProject () << { if (hasProperty(initPlugins)) { initPlugins.split(',').each { plug -> project.apply { plugin(plug.trim()) } } } project.sourceSets.all*.allSource.sourceTrees.srcDirs.flatten().each { dir -> dir.mkdirs() } }You could execute this with gradle.bat initProject -PinitPlugins=Java,Groovy,Scala
apply plugin: 'java' apply plugin: 'groovy' apply plugin: 'scala' task initProjectStructure () << { project.sourceSets.all*.allSource.sourceTrees.srcDirs.flatten().each { dir -> dir.mkdirs() } }task initProject () << { if (hasProperty(initPlugins)) { initPlugins.split(',').each { plug -> project.apply { plugin(plug.trim()) } } } project.sourceSets.all*.allSource.sourceTrees.srcDirs.flatten().each { dir -> dir.mkdirs() } }