Use Gradle to package project jar files
Both Ant and Maven build tools use xml to describe the task structure. In general, You can package projects and other tasks, but xml is slightly less flexible after all,
The new enterprise build tool Gradle is similar to the shell script on linux and uses Groovy Dynamic Language to write scripts.
Version: Gradle in version 2.2
// Date 20141220 apply plugin: 'java' version = '0. 1 'archivesbasename = "myfirstpj" // if this parameter is left blank, the project name + version repositories {mavenCentral ()} sourceSets {main {java {srcDirs = ['src'] }}dependencies {compile fileTree (dir: 'lib', include :'*. jar ')} // compile dependencies, and then package JARtask taskJar (type: Jar, dependsOn: compileJava) {from 'build/classes 'destinationdir = file ('build/libs ')} // clear the last compiled file task clearPj (type: Delete) {delete 'build ', 'target'} // Copy the JAR file to the target directory task release (type: Copy, dependsOn: [clearPj, taskJar]) {from ('build/libs') {include '*. jar '} into ('target ')}
Run
Gradle releaseYou can.