Hi all
I’ve tried to make a fat jar with the groovy scripts (in source code) from the dir src/main/scripts
into the jar (at the root of the jar).
But I’ve tried many configurations, no one seems to work
I want to include all the groovy and sql,mongo,etc. dependencies into this fat jar to execute the groovy scripts with one java call,
because in my server groovy is not installed.
Like this
java -cp helmeplease-all-1.0.jar groovy.ui.GroovyMain jar:file:helmeplease-all-1.0.jar'!'/thankyou.groovy
:gradlephant: My current build.gradle is here
group 'helmeplease'
version '1.0'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
mavenCentral()
mavenLocal()
// ...
}
dependencies {
compile group:'mysql', name:'mysql-connector-java', version:'5.1.46'
compile 'commons-dbcp:commons-dbcp:1.4'
compile group:'org.mongodb', name:'mongo-java-driver', version:'2.11.3'
compile 'org.codehaus.groovy:groovy-all:2.1.9'
compile group:'com.gmongo', name:'gmongo', version:'1.3'
}
jar {
manifest {
attributes 'Implementation-Title': 'lopd_importer', 'Implementation-Version': version
}
}
task fatJar(type: Jar) {
dependsOn install
manifest {
attributes 'Manifest-Version': '1.0', 'Implementation-Title': 'gd-web-lexnet-firma-client', 'Implementation-Version': version
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
I’ve tried with
sourceSets.main.resources.srcDirs += [ "src/main/scripts" ]
Also with
task fatJar(type: Jar) {
// ...
from('src/main/scripts) {
include '**/*.groovy'
}
//...
}
And many more variations, but it seems I can’t hit the nail
Anyone knows how to make it ?
Thanks