{"action":"created","issue":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/6683","repository_url":"https://api.github.com/repos/bazelbuild/bazel","labels_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6683/labels{/name}","comments_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6683/comments","events_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6683/events","html_url":"https://github.com/bazelbuild/bazel/issues/6683","id":381068288,"node_id":"MDU6SXNzdWUzODEwNjgyODg=","number":6683,"title":"Feature: java_library.resource_add_prefix","user":{"login":"RaresI","id":20816105,"node_id":"MDQ6VXNlcjIwODE2MTA1","avatar_url":"https://avatars3.githubusercontent.com/u/20816105?v=4","gravatar_id":"","url":"https://api.github.com/users/RaresI","html_url":"https://github.com/RaresI","followers_url":"https://api.github.com/users/RaresI/followers","following_url":"https://api.github.com/users/RaresI/following{/other_user}","gists_url":"https://api.github.com/users/RaresI/gists{/gist_id}","starred_url":"https://api.github.com/users/RaresI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RaresI/subscriptions","organizations_url":"https://api.github.com/users/RaresI/orgs","repos_url":"https://api.github.com/users/RaresI/repos","events_url":"https://api.github.com/users/RaresI/events{/privacy}","received_events_url":"https://api.github.com/users/RaresI/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-15T09:19:54Z","updated_at":"2018-11-16T00:57:17Z","closed_at":null,"author_association":"NONE","body":"### Description of the feature request:\r\n\r\njava_library has a resource_strip_prefix property which removes a path prefix. Please add the complementary property \"resource_add_prefix\" which would place files in a different folder.\r\n\r\n### Feature requests: what underlying problem are you trying to solve with this feature?\r\n\r\nMany times resources need to be placed in specially named folders in order to work. For example, Java ServiceLoader resources have to be placed under META-INF/services. Ideally, in the source folders the resource file would be placed right near the {Service}.java it describes. Currently that is not possible, it has to be either placed in a META-INF/services subfolder (which increases the complexity of the directory structure) or in a dedicated resources/META-INF/services folder which aggreggates all service resource, which breaks modularity.\r\n\r\nWithout resource_add_prefix:\r\nService.java\r\nMETA-INF/\r\n    services/\r\n        com.test.Service\r\n\r\nWith proposed resource_add_prefix='META-INF/services':\r\nService.java\r\ncom.test.Service\r\n\r\n### What operating system are you running Bazel on?\r\nWindows 10\r\n\r\n### What's the output of `bazel info release`?\r\nrelease 19.1\r\n\r\n###  Have you found anything relevant by searching the web?\r\nNothing"},"comment":{"url":"https://api.github.com/repos/bazelbuild/bazel/issues/comments/439244436","html_url":"https://github.com/bazelbuild/bazel/issues/6683#issuecomment-439244436","issue_url":"https://api.github.com/repos/bazelbuild/bazel/issues/6683","id":439244436,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTI0NDQzNg==","user":{"login":"cushon","id":478458,"node_id":"MDQ6VXNlcjQ3ODQ1OA==","avatar_url":"https://avatars0.githubusercontent.com/u/478458?v=4","gravatar_id":"","url":"https://api.github.com/users/cushon","html_url":"https://github.com/cushon","followers_url":"https://api.github.com/users/cushon/followers","following_url":"https://api.github.com/users/cushon/following{/other_user}","gists_url":"https://api.github.com/users/cushon/gists{/gist_id}","starred_url":"https://api.github.com/users/cushon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cushon/subscriptions","organizations_url":"https://api.github.com/users/cushon/orgs","repos_url":"https://api.github.com/users/cushon/repos","events_url":"https://api.github.com/users/cushon/events{/privacy}","received_events_url":"https://api.github.com/users/cushon/received_events","type":"User","site_admin":false},"created_at":"2018-11-16T00:57:17Z","updated_at":"2018-11-16T00:57:17Z","author_association":"CONTRIBUTOR","body":"> ServiceLoader resources have to be placed under `META-INF/services`\r\n\r\nConsider using [AutoService](https://github.com/google/auto/tree/master/service#autoservice) for this. It's an annotation processor that generates the `META-INF/services` files for you.\r\n\r\n> Currently that is not possible\r\n\r\nIt's not possible using attributes on `java_library`, but if it's necessary to have full control over the resource layout you can generate a separate `.jar`, add it to the build using `java_import`, and then add the `java_import` to the `deps` or `runtime_deps` of the original `java_library`."}}
{"actor":{"display_login":"cushon"}}