The answer the first question, the only thing you need for compiling and building a java app is the java plugin. You can have a build.gradle file with only the following line:
apply plugin: 'java'
From here, you can decide to add other plugins for packaging, for a specific IDE, etc.
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( )?
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The answer the first question, the only thing you need for compiling and building a java app is the
java
plugin. You can have abuild.gradle
file with only the following line:From here, you can decide to add other plugins for packaging, for a specific IDE, etc.
For the second question, the gradle documentation is well done. I would start here docs.gradle.org/current/userguide/....
I tried the first thing already, it throws an error, and I was advised to use:
Is this (not) correct?
Yes, this is correct. Both:
and
are importing the
java
plugin for your project. From there you can usegradle build
to build your project.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 toapply( )
?Thanks for your help so far.
Cheers.
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.