gradle打包依赖jar

apply plugin: 'java'
apply plugin: 'maven'

sourceSets {
    main {
        java {
            srcDir 'src/java'
        }
        resources {
            srcDir 'src/resources'
        }
    }
}

repositories {
	mavenCentral()
}

dependencies {
	compile (
	    	"org.eclipse.jetty.websocket:websocket-client:9.3.0.M1"	
	) 
}

jar {
	manifest {
		attributes 'Main-Class': 'com.xxx.screenshot.WebSocketClientTest'
	}
	from {
		configurations.compile.collect {
		    it.isDirectory() ? it : zipTree(it)
		}
		configurations.runtime.collect {
		    it.isDirectory() ? it : zipTree(it)
		}
	}
}

 

你可能感兴趣的:(gradle)