Coder Social home page Coder Social logo

gradle-plugins's Introduction

Overview

Release

This is the standard Analytic Spot plugin for building Java libraries. Aside from applying the Gradle java plugin, this configures things in our standard way (e.g. uses our Lint files, runs tests with testNG, etc.). It also adds some convenience properties like the "provided" configuration. The following subsections explain the configuration this plugin applies.

Java Configuration

We have a fairly standard Java setup except:

Testing

We use testNG and add some custom hooks that report which tests failed at the end of the build if any fail.

The Provided Configuration

The provided configuration allows developers to add a dependency as "provided" meaning you need the dependency on your IDE classpath and when you compile, but when generating jars and listing transitive dependencies the dependency should be ignored. Example use case would be a Spark job: the Spark libraries are used in the code and so are needed to compile, but they're huge and already on the cluster and in the classpath so we don't want to include them in the generated jar. To use just do something like:

dependencies {
   provided 'org.apache.spark:spark-core_2.11:2.1.1'
}

Appying the Plugin

With the old plugin syntax you need something like the following in your build.gradle:


buildscript {
    repositories {
        // our plugin is on jitpack
        maven { url 'https://jitpack.io' }
        // out plugin relies on some things that need to be fetched
        // from jcenter or mavenCentral
        jcenter()
    }
    dependencies {
        classpath "com.github.analyticspot:gradle-plugins:$PLUGIN_VERSION"
    }
}

apply plugin: 'com.analyticspot.javaLibrary'

If you are developing the plugin and you want to test local changes you can add mavenLocal() to the repository list.

You can find the current version by looking at our tags or the jitpack badge at the top of this README.

Important: currently you can only apply this plugin using the old plugin syntax. See the New Plugin Syntax Issues section for details on why and how this could be fixed.

New Plugin Synatx Issues

Since I'm publishing on jitpack without a custom domain name the plugin marker artifact won't trigger jitpack to pull and build our project so the artifact won't exist and this does not work. However, we could later publish elsewhere or add a custom domain name and make this work. If so this is how this could work with the new plugin syntax:

First, add the repository containing the plugin to settings.gradle (not your build.gradle) like so:

pluginManagement {
    repositories {
        maven {
            url 'https://repo.with/plugin'
        }
    }
}

and then add the following to your build.gradle:

plugins {
    id 'com.analyticspot.javaLibrary' version '0.2'
}

The new pluginManagement block does not support snapshots or mavenLocal() though you can add something like maven { url '/home/username/.m2/repository' } to the repositories block to get a limited version of local publishing working.

gradle-plugins's People

Contributors

odain2 avatar oliverdain avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.