Skip to content

lemonbashar/ExportJarGradlePlugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExportJarGradlePlugin

When we have a Java application and we want to make it executable, then we need many configuration and command-line task, and sometimes if everything looks ok, but there exist's a silly mistake, you can't run the executable jar file.

The problem can be much more bigger and you have to face following challenges if,

  1. The application depend's on many other jar file.
  2. You have to make it's executable file, and link-up with dependencies.

To solve those problem, here's the solution for your gradle project. Here the gradle-plugin named ExportJar, to use this plugin you have to build the plugin first.

gradle build

Then use the plugin and make your gradle build file.

FILE: build.gradle

import com.lemon.framework.gradleplugin.task.Executable

buildscript {

    repositories {
        mavenLocal()
        mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }

    dependencies {
        classpath "com.lemon.framework:gradle-plugin:$frameworkVersion"
    }
}

jar {
    exclude exportJar.exclude
    manifest {
        attributes('Main-Class':"your.package.YourMainClassName") /*Fully-Qualified Main Class Name*/
        attributes('Class-Path':exportJar.dependencies())
    }
}

Then if you run

gradle exportJar

It will create an executable jar file in /export directory and copy all of it's dependencies on a directory named /library and link-up those with executable jar file.

You can change the name of directories, by specifying

    exportJar {
        exportLocation="exportedDir"
        dependencyLocation='lib'
    }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages