Groovy - How to Build a Jar -


i've written groovy script has dependency on sql server driver (sqljdbc4.jar). can use groovywrapper (link below) compile jar, how can dependencies jar? i'm looking "best practice" sort of thing.

http://groovy.codehaus.org/wrappinggroovyscript

both of replies below have been helpful, how can signed jar files? instance:

exception in thread "main" java.lang.securityexception: invalid signature file d igest manifest main attributes

in groovy wrapper script, you'll see line near bottom:

// add more jars here 

that's can add dependencies. if jar file in same directory you're building from, add line this:

zipgroupfileset( dir: '.', includes: 'sqljdbc4.jar' ) 

then rerun script , jar include classes sqljdbc4.jar.

edit:

if jar file depend on signed , need maintain signature, you'll have keep external jar. can't include jar files inside of other jar files without using custom classloader. can, however, specify dependency in manifest avoid having set classpath, i.e. jar still executable java -jar myjar.jar. update manifest section in wrapping script to:

manifest {     attribute( name: 'main-class', value: mainclass )     attribute( name: 'class-path', value: 'sqljdbc4.jar' ) } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -