I’m trying to create new project using build init plugin. That’s what I did:
c:\svn>gradle init
It turns out gradle puts configuration files directly in c:\svn directory, which is not what I would expect. I think it should either ask you for the name of the project, or you should use it like this:
c:\svn>gradle init my-project
this is how the output should look like: c:\
svn
my-project
build.gradle
settings.gradle
After that we can add new projects to this multi-module root:
To me the way this plugin works now is counterintuitive and should be improved. Why it was designed differently? Shouldn’t it be more similar to maven archetype plugin?
thanks for your valuable feedback. As listed in the release notes, the gradle init task is still considered “incubating” and in active development. Usually the build.gradle file of a project is located directly in the project folder. In your 2nd expected output, you have two settings.gradle and two build.gradle files on root level above those two project directories. What I can think of is, that gradle might provide support for adding an subproject to an existing multiproject build. Triggering “gradle init --type --java-library my-core” in a gradle multiproject root directory would add a subfolder ‘my-core’ with an according build.gradle file and add this my-core project to the multiproject build by adding an “include ‘:my-core’” to the setttings.gradle file.
Sorry, I lost the formatting. Here’s what I’d like to get in second example (like you said - I’d like to have support for adding new subproject to existing multiproject).
We don’t thought about renaming it as we just renamed it from setupBuild to init. “init” seems very concise to me and is also used in other projects (e.g. “git init”)
I will still love it and use it even if it will be called “gradle init” forever! But still I have to add my two cents - we need those discussions now, when it’s still in incubator:) Please look at these:
grails create-app my-app griffon create-app my-app rails new my-app
That’s why it seems to me that ‘gradle create’ would be better if I’m creating new project (we can always create alias for gradle init).
Personally I think ‘gradle init’ is good name when I’m converting maven project into gradle project. ‘Chapter 47. Build Init Plugin’ is definitely better than ‘Chapter 47. Build Setup Plugin’ (we probably can’t call it ‘Gradle Archetype Plugin’ nor ‘Gradle Skeleton Plugin’)
On the other hand… maybe ‘gradle init’ should be split into two separete plugins? Right now it does two things: creates new project and converts existing ant/maven project. Maybe it is perfectly fine, maybe it needs rethinking - I don’t know. I wish there was more people involved!