The Meson Build System http://mesonbuild.com/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

804 B

JAR Resources

The ability to add resources to a JAR has been added. Use the java_resources keyword argument. It takes a sturctured_src object.

jar(
  meson.project_name(),
  sources,
  main_class: 'com.mesonbuild.Resources',
  java_resources: structured_sources(
    files('resources/resource1.txt'),
    {
      'subdir': files('resources/subdir/resource2.txt'),
    }
  )
)

To access these resources in your Java application:

try (InputStreamReader reader = new InputStreamReader(
        Resources.class.getResourceAsStream("/resource1.txt"),
        StandardCharsets.UTF_8)) {
    // ...
}

try (InputStreamReader reader = new InputStreamReader(
        Resources.class.getResourceAsStream("/subdir/resource2.txt"),
        StandardCharsets.UTF_8)) {
    // ...
}