Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Gradle Natives Plugin

Build Status Coverage Status

A Gradle plugin to aid in working with Java-based projects that provide supporting native libraries.

Current Status: Abandoned

This plugin started out to solve the simple problem of making the native libraries stored in dependency jar files more easily usable in Gradle projects, namely the simple game project that I was working on at the time. When I stopped working on the game project, it seemed that there was some interest in the plugin so I kept it up and tried to make it a bit better. Personally, I have not used it since a few months after it was written, and I have other projects that I do actually use, so I am listing this project as abandoned.

That being said, I will make some attempt to keep it building successfully under current Gradle and Groovy trends; however, most reported issues probably won't get much attention. You are welcome to submit pull requests for fixes and features and I will review and act on them in a timely manner.


./gradlew clean build


To add the plugin to your project, add the following to your build.gradle file (or update the buildscript block if it already exists):

buildscript {
  repositories {
    maven {
      url ""
  dependencies {
    classpath ""

apply plugin: "com.stehno.natives"

Alternately, you can use the new plug definition block in Gradle 2.1 and beyond.

plugins {
	id 'com.stehno.natives' version '0.3.1'

The plugin is compiled on Java 7.


Without any additional configuration, the plugin will find all native libraries in all compile and runtime dependency configurations, for all platforms, and unpack them into the build/natives directory of your project. You can configure this behavior by adding a natives block to your build.gradle file. The default behavior has the following configuration:

natives {
    configurations = ['compile', 'runtime']
    platforms = Platform.all()
    outputDir = 'natives'

A libraries Closure may also be added to filter the resolved libraries, such as:

natives {
    configurations = ['compile', 'runtime']
    platforms = Platform.all()
    outputDir = 'natives'
    libraries {
        exclude = ['somelib.dll']

There are two tasks provided by the plguin:

  • listNatives - lists all of the native libraries resolved by the current configuration.
  • includeNatives - includes (copies) the resolved native libraries into the configured output directory.


This plugin only resolves native libraries that are on the project classpath as dependencies of the project (Gradle dependencies, either direct or transitive).


You can’t perform that action at this time.