How to build resources as part of the jar?


(Dasthagiri Shaik) #1

Hi , I am facing a problem with the jar which i build doesn’t have resources with that.because of that my devices which are refered by those resources are not loaded properly.

Below mentioned code used in build.gradle to build the resources as part of my jar.

jar {

from(‘src’) {

include ‘./*.png’

include ‘./doc/Art_files/*.png’

include ‘./resources/*.png’

include ‘./resources/ui/*.px’

include ‘./resources/graphics/*.px’

include ‘./resources/graphics/*.bog’

include ‘./icons/.

include ‘./xml/accessoryLoopWizardCfg.xml’

include ‘./xml/commonWizardCfg.xml’

include ‘./xml/vavWizardsCfg.xml’

include ‘./xml/cvahuWizardsCfg.xml’

include ‘./xml/ascotVavLayout.xml’

include ‘./xml/ascotCvahuLayout.xml’

include ‘./doc/*.html’

} }


(Carlo Luib-Finetti) #2

I do these like this:

jar {
 into ('/META-INF') {
  from fileTree ('./META-INF') {
   include '**/spring*'
  }
 }
 into ('/web') {
  from fileTree ('./web')
 }
 into ('/') {
  from file('./splash.bmp')
  from file('./applicationContext.xml')
   }
}

(Dasthagiri Shaik) #3

Hi carlo,

below mentioned syntax helps me out, removed ./ from the include statements.

jar { from(‘src’) { include ‘.png’ include ‘doc/Art_files/.png’ include ‘resources/.png’ include ‘resources/ui/.px’ include ‘resources/graphics/.px’ include ‘resources/graphics/.bog’ include ‘icons/.’ include ‘xml/accessoryLoopWizardCfg.xml’ include ‘xml/commonWizardCfg.xml’ include ‘xml/vavWizardsCfg.xml’ include ‘xml/cvahuWizardsCfg.xml’ include ‘xml/ascotVavLayout.xml’ include ‘xml/ascotCvahuLayout.xml’ include ‘doc/*.html’ } }