A set of gradle build conventions to eliminate build boilerplate and enforce coding standards
// TODO change gradle snippet once we have a release version
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url 'https://oss.jfrog.org/artifactory/libs-snapshot/'
}
}
dependencies {
classpath group: 'com.novarto', name: 'java-conventions',
version: '0.9.1-SNAPSHOT'
}
}
Then you need to supply project version prior to applying plugins:
group 'foo'
version '0.42-SNAPSHOT'
Then you apply plugins:
//general build conventions
apply plugin: 'com.novarto.javaconventions'
//publish to bintray or jfrog oss snapshots:
apply plugin: 'com.novarto.osspublish'
These are gradle plugins which are mostly intended to share build logic / reduce boilerplate in the various projects under https://github.com/novarto-oss. At this point they probably are not flexible enough to be used as general purpose build plugins. That being said, you could give them a shot and let us know of any problems via an issue.
- applies the
java
plugin - applies and configures the
maven-publish
plugin. Adds sources and javadoc jars to the defaultmavenJava
publication - configures java for 1.8 source and target compat
- turns on javac strict mode such that all warnings are reported, and any warning fails the build
- adds parameter information to the java bytecode so that you can deserialize immutable classes without the
@JsonProperty
madness et al. - Makes gradle fail in case there are different version of the same lib on your build path
- Sets up source jar build
- Applies
checkstyle
with this template - Applies
jacoco
- Tweaks
test
andjavadoc
with some sane defaults - Applies findbugs. Turned off by default since it is painfully slow and might make you quit your job. Canonical use is to turn it on via a commandline parameter
Use this only if your project is an opensource project, this publishes artifacts to public oss repositories. Licence is by default hardcoded to APL 2
- Configures publish to bintray, or jfrog oss snapshots, depending on whether your project version is release or a
-SNAPSHOT
one - Configures credentials with whatever you export in the
PUBLISH_USER
andPUBLISH_KEY
env vars