I am building the HyperQuest plugin atm at www.github.com/kourbou/HyperQuest but I am having trouble with my Gradle build. I am 100% new to Gradle and I wanted to get the License pre-commit system Sponge has but I tried copying the build.gradle file sponge has and it failed. Could someone help me out? Thanks a lot, in advance.
PS: I posted this in Plugin Support. If this was incorrect please move it to the proper category. Thanks.
Edit: i looked at your build.gradle.
You need to get the plugin as dependency first. So you need to add this to your buildscript section:
Then add this:
apply plugin: 'license'
Also, this here:
will make gradle run that task every time you use it automatically.
For license header formatting do this:
//the project name to use
ext.name = project.name
//the organizations name etc
ext.organization = project.organization
ext.url = project.url
ext.year = project.inceptionYear
//for usage of these values see this: https://github.com/hierynomus/license-gradle-plugin#variable-substitution
//files to exclude from formatting (anything that is a .info file and assets in this example)
//the file that contains the header
//the source sets to apply the license to
//this should be enough for you, it covers all the projects source sets
sourceSets = project.sourceSets
//what style your comment should be
//in this case it's the following: /* and then continuing with stars.
java = 'SLASHSTAR_STYLE'
Further documentation of the license section can be found here: GitHub
Hope I could help you.
lol. Sorry forgot to commit (done now). See when I run
./gradlew licenseFormat it just says
UP-TO-DATE and no headers get added in the file. I have tried everything.
Edit: Wow I am very sorry you had to write all of this. I actually have most of what you did in the Gradle file. Still nothing… Just the “its uptodate man!” and no changes in files.
Could you commit your HEADER.txt
Edit: nevermind It’ll be there for future reference at least. Gradle can sometimes be confusing
Done. Gradle is very confusing…
Edit: Thanks a lot for the help you are giving!
I think I may have forgotten the source sets. Was that important?
It should by default use all. What i’m ondering is wether your sourceSets contain anything… (at least from the scripts point of view)
How do I even set my source sets? I have not configured this at all.
Well clearly i’m an idiot…
Wait so I need to specify my source set? The SpongeAPI gradle.build doesn’t seem to have that. Im so confused.
Well, yes, the issue is in fact that you have not source sets or are not using them, if I build your project the jar only contains the META-INF and no compiled classes.
So, the problem was, that you had your source directory set up in a non conventional way (convention: src/main/java/yourpackageshere, yours: src/yourpackageshere). That non conventional setup requires adding the directory to the sourceSets specifically. I’d recomment that you go with just refactoring it to fith the convention.
Woooooops. Thanks a bunch! I guess conventions do matter. -.-