DEV Community

Discussion on: Two Gradle questions I have.

Collapse
 
ehudon profile image
ehudon

Yes, this is correct. Both:

apply plugin: 'java'
Enter fullscreen mode Exit fullscreen mode

and

plugins {
    id "java"
}
Enter fullscreen mode Exit fullscreen mode

are importing the java plugin for your project. From there you can use gradle build to build your project.

Thread Thread
 
baenencalin profile image
Calin Baenen

Do I need both, or just the bottom one (since the first one gives me an error (Why does it do that?))?
How do I structure it, the plugins block, then the call to apply( )?

Thanks for your help so far.
Cheers.

Thread Thread
 
ehudon profile image
ehudon • Edited

No what you have above is enough, you only need the lines above in a file named build.gradle. You will need to use gradle conventions which are the same as maven. I created a gist for you here gist.github.com/ehudon/7379f19f33b.... You can copy this file in your project and it should work if you have the correct project layout.