the solution I ended up using was this:

I added my jars to sourceSets/resources like:
sourceSets {
  main {
    java {
      srcDir "$wepTrunk/osgi/myco.osgi.server/src"
    }
    resources {
      srcDir "$wepTrunk/osgi/myco.osgi.server/lib"
    }
  }
}

jar.doFirst{
  def mainDir = "$buildDir/classes/main"
  def libDir = "$mainDir/lib"
  ant.move(file:"$mainDir/enttoolkit.jar", toDir:"$libDir")
  ant.move(file:"$mainDir/mail.jar", toDir:"$libDir")
}

seems ugly, but all the solutions seem ugly.

>>
>> OK, I don't want to embed the contents of another jar...... I want to
>> put another jar in my output jar inside a "lib" directory.
>>
>> Still struggling with this.
>>
>> thanks
>>
>> On Tue, Aug 10, 2010 at 5:41 AM, Steve Appling <[email protected]>
>> wrote:
>>>
>>> On Aug 9, 2010, at 6:01 PM, phil swenson wrote:
>>>
>>>> I figured out part 1 of my question (and also how to specify
>>>> symbolicName) and now my jar task looks like:
>>>>
>>>> jar {
>>>>  archiveName="com.mycompany.osgi.server_8.2.0.0000-0001.jar"
>>>>
>>>>  manifest {
>>>>   version = '1.0'
>>>>   name = 'Server'
>>>>   symbolicName="com.mycompany.osgi.server"
>>>>   instruction 'Bundle-Version',  '8.2.0.0000-0001'
>>>>   instruction 'Bundle-ManifestVersion', '2'
>>>>   instruction 'Require-Bundle', 'com.mycompanyosgi.proxy',
>>>>                 'com.mycompany.wep.plugin.runtime',
>>>> 'com.mycompany.eda.orchestrator',
>>>>                 'com.mycompany.osgi.is.core', ' org.eclipse.osgi',
>>>> 'javax.jms'
>>>>   instruction 'Bundle-Activator',
>>>> 'com.mycompany.wep.osgi.server.Activator'
>>>>   instruction 'Import-Package', ' com.mycompany.server',
>>>>  'com.mycompany.data'
>>>>   instruction 'Bundle-ClassPath', '.,lib/enttoolkit.jar', 'lib/mail.jar'
>>>>   instruction 'Eclipse-ExtensibleAPI', 'true'
>>>>  }
>>>> }
>>>>
>>>> still don't know how to embed a lib/enttoolkit.jar and mail.jar in
>>>> there though....
>>>>
>>>> ideas?
>>>>
>>> You can use zipTree to embed the contents of another jar.  If you are
>>> wanting to add in all of your compile dependencies, you would use something
>>> like this inside of your jar configuration:
>>>  from configurations.compile.collect { it.isDirectory() ? it :
>>> zipTree(it).matching { exclude 'META-INF/MANIFEST.MF' } }
>>>
>>> The ".matching {...}" part is needed in rc1, but will not be needed in
>>> the final release.
>>> --
>>> Steve Appling
>>> Automated Logic Research Team
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>   http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to