What is the replacement for metaInf in Gradle 2.0?

(Russel Winder) #1

Using Gradle 1.12 the line:

metaInf << fileTree(dir: ‘…’).matching{include ‘LICENCE.txt’}

works fine. Under Gradle 2.0-rc-1 this line is an error:

  • What went wrong: A problem occurred evaluating root project ‘Gant’. > Could not find property ‘metaInf’ on project ‘:gant’.

I checked the release notes which mention that metaInf is replaced rather than removed.

(Perryn Fowler) #2

The release notes say

JavaPluginConvention.metaInf replaced with Jar.metaInf.

What that means is that you need to set metaInf configuration directly on each jar task, rather than at the top level of the java plugin.

So you want to use Jar.metaInf to configure your jar task(s).

Note that Jar.metaInf is configured via a copySpec rather than a List

(Russel Winder) #3

Aha, so I replace the earlier line with:

metaInf{from(’…’){include ‘LICENCE.txt’}}

in the jar configuration and it all seems to work fine, not only with 2.0-rc-1 but also 1.12. Which means I should have made this change long ago :slight_smile:

Thanks muchly for the prompt response, greatly appreciated.