Can DropWizard serve assets from outside the jar file?

后端 未结 6 598
猫巷女王i
猫巷女王i 2020-12-31 05:52

In looking at the documentation, it appears that DropWizard is only able to serve static content living in src/main/resources. I\'d like to keep my static files in a separat

6条回答
  •  旧巷少年郎
    2020-12-31 06:36

    To complement craddack's answer: Correct, you can use the regular AssetsBundle as long as you add the assets to your classpath. If you use gradle and oneJar, you can add a directory to the classpath in the oneJar task:

    task oneJar(type: OneJar) {
      mainClass = '...'
      additionalDir = file('...')
      manifest {
        attributes 'Class-Path': '.. here goes the directory ..'
      }
    }
    

    see https://github.com/rholder/gradle-one-jar

提交回复
热议问题