Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-1289

Provide a "create-project" command to create a skeleton project directory.

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: New Feature New Feature
  • Status: Resolved 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).

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews
Adam Murdoch made changes - 09/Jan/11 9:55 PM
Field Original Value New Value
Assignee Hans Dockter [ hans_d ]
Contegix Support made changes - 19/Mar/11 9:23 AM
Project Import Sat Mar 19 09:23:24 CDT 2011 [ 1300544604020 ]
Hide
Permalink
Leonard Brünings added a comment - 24/Mar/11 5:14 AM - edited

The Script below will create the src file structure for a new project based on the used plugins.
(Tested with gradle-1.0-milestone1)

build.gradle
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'scala'

task initProjectStructure () << {
	project.sourceSets.all*.allSource.sourceTrees.srcDirs.flatten().each { dir ->
		dir.mkdirs()
	}
}
improved version, call from cmdline
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

Show
Leonard Brünings added a comment - 24/Mar/11 5:14 AM - edited The Script below will create the src file structure for a new project based on the used plugins. (Tested with gradle-1.0-milestone1)
build.gradle
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'scala'

task initProjectStructure () << {
	project.sourceSets.all*.allSource.sourceTrees.srcDirs.flatten().each { dir ->
		dir.mkdirs()
	}
}
improved version, call from cmdline
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
Daz DeBoer made changes - 03/Aug/11 3:30 PM
Workflow jira [ 12328 ] jira with pivotal tracker [ 14499 ]
Hide
Permalink
Keith Koski added a comment - 07/Aug/11 9:26 AM

I tried improved version with 1.0-milestone-4. It fails with "Could not find property 'sourceSets' on root project 'fff'."

Show
Keith Koski added a comment - 07/Aug/11 9:26 AM I tried improved version with 1.0-milestone-4. It fails with "Could not find property 'sourceSets' on root project 'fff'."
Hide
Permalink
Peter Niederwieser added a comment - 12/Aug/11 7:47 PM

Have a look at the Templates plugin: https://launchpad.net/gradle-templates

Show
Peter Niederwieser added a comment - 12/Aug/11 7:47 PM Have a look at the Templates plugin: https://launchpad.net/gradle-templates
Hide
Permalink
Steve Olsen added a comment - 17/Sep/11 11:01 PM

I've been looking for this capability everywhere. Maven does this, why not Gradle?

Show
Steve Olsen added a comment - 17/Sep/11 11:01 PM I've been looking for this capability everywhere. Maven does this, why not Gradle?
Hide
Permalink
Adam Murdoch added a comment - 18/Sep/11 7:34 PM

@steve, there's no good reason, other than we haven't gotten around to it yet. Hopefully soon after Gradle 1.0 is released, we will tackle this problem.

Show
Adam Murdoch added a comment - 18/Sep/11 7:34 PM @steve, there's no good reason, other than we haven't gotten around to it yet. Hopefully soon after Gradle 1.0 is released, we will tackle this problem.
Hide
Permalink
mark petrovic added a comment - 25/Aug/12 8:54 AM

I'm interested in this feature, which will really help newcomers get started quickly in creating new projects.

Show
mark petrovic added a comment - 25/Aug/12 8:54 AM I'm interested in this feature, which will really help newcomers get started quickly in creating new projects.
Hide
Permalink
Lukas Bradley added a comment - 26/Sep/12 7:27 PM

I've updated Leonard's script above to work with 1.2.

apply plugin: 'java'

task initProject () << {
	if (hasProperty(initPlugins)) {
		initPlugins.split(',').each { plug -> project.apply { plugin(plug.trim()) } }
	}	

	project.sourceSets*.allSource.srcDirTrees.flatten().dir.each { dir ->
		dir.mkdirs()
	}
}
Show
Lukas Bradley added a comment - 26/Sep/12 7:27 PM I've updated Leonard's script above to work with 1.2.
apply plugin: 'java'

task initProject () << {
	if (hasProperty(initPlugins)) {
		initPlugins.split(',').each { plug -> project.apply { plugin(plug.trim()) } }
	}	

	project.sourceSets*.allSource.srcDirTrees.flatten().dir.each { dir ->
		dir.mkdirs()
	}
}
Luke Daley made changes - 03/Jan/13 5:08 AM
Workflow jira with pivotal tracker [ 14499 ] jira with pivotal tracker (no resolved, only closed) [ 16281 ]
Luke Daley made changes - 04/Jan/13 5:09 AM
Workflow jira with pivotal tracker (no resolved, only closed) [ 16281 ] Copy of jira with pivotal tracker (no closed, only resolved) [ 18956 ]
Hide
Permalink
Michael Peterson added a comment - 01/Apr/13 9:23 PM - edited

I'm new to gradle, but none of the above examples work for me as written.

For just Java, you have to issue this cmd: gradle initProject -PinitPlugins=java (Note: lowercase 'j')

or change this line:
initPlugins.split(',').each { plug -> project.apply { plugin(plug.trim()) } }

to:
project.apply { plugin('java') }

and then just do:
gradle initProject

from the cmd line

+1 for getting this feature added quickly.

Show
Michael Peterson added a comment - 01/Apr/13 9:23 PM - edited I'm new to gradle, but none of the above examples work for me as written. For just Java, you have to issue this cmd: gradle initProject -PinitPlugins=java (Note: lowercase 'j') or change this line: initPlugins.split(',').each { plug -> project.apply { plugin(plug.trim()) } } to: project.apply { plugin('java') } and then just do: gradle initProject from the cmd line +1 for getting this feature added quickly.
Hide
Permalink
Adam Murdoch added a comment - 01/May/13 6:32 PM

Gradle 1.6 and 1.7 add some support for setting up a new Gradle build using the `build-setup` plugin.

This initial support is very basic and we want to grow it in future releases, but I've marked this issue as 'fixed'. If you find problems or have suggestions for improvements to this build initialization support, please feel free to raise new issues via the forums.

You can find out more about our plans in this design spec: https://github.com/gradle/gradle/blob/master/design-docs/build-initialisation.md

Show
Adam Murdoch added a comment - 01/May/13 6:32 PM Gradle 1.6 and 1.7 add some support for setting up a new Gradle build using the `build-setup` plugin. This initial support is very basic and we want to grow it in future releases, but I've marked this issue as 'fixed'. If you find problems or have suggestions for improvements to this build initialization support, please feel free to raise new issues via the forums. You can find out more about our plans in this design spec: https://github.com/gradle/gradle/blob/master/design-docs/build-initialisation.md
Adam Murdoch made changes - 01/May/13 6:32 PM
Resolution Fixed [ 1 ]
Fix Version/s 1.7-rc-1 [ 10675 ]
Status Open [ 1 ] Resolved [ 5 ]
Unable to get TeamCity builds: No active plugin license is found! Please visit http://stiltsoft.com/teamcity for details

People

  • Assignee:
    Unassigned
    Reporter:
    Paul Cager
Vote (43)
Watch (32)

Dates

  • Created:
    05/Jan/11 11:52 AM
    Updated:
    01/May/13 6:32 PM
    Resolved:
    01/May/13 6:32 PM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.