{"action":"created","issue":{"url":"https://api.github.com/repos/asciidoctor/asciidoctor-maven-plugin/issues/193","labels_url":"https://api.github.com/repos/asciidoctor/asciidoctor-maven-plugin/issues/193/labels{/name}","comments_url":"https://api.github.com/repos/asciidoctor/asciidoctor-maven-plugin/issues/193/comments","events_url":"https://api.github.com/repos/asciidoctor/asciidoctor-maven-plugin/issues/193/events","html_url":"https://github.com/asciidoctor/asciidoctor-maven-plugin/pull/193","id":125925996,"number":193,"title":"Preview for #174 and #187 - Selecting and filtering sources and resources","user":{"login":"abelsromero","id":5781153,"avatar_url":"https://avatars.githubusercontent.com/u/5781153?v=3","gravatar_id":"","url":"https://api.github.com/users/abelsromero","html_url":"https://github.com/abelsromero","followers_url":"https://api.github.com/users/abelsromero/followers","following_url":"https://api.github.com/users/abelsromero/following{/other_user}","gists_url":"https://api.github.com/users/abelsromero/gists{/gist_id}","starred_url":"https://api.github.com/users/abelsromero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelsromero/subscriptions","organizations_url":"https://api.github.com/users/abelsromero/orgs","repos_url":"https://api.github.com/users/abelsromero/repos","events_url":"https://api.github.com/users/abelsromero/events{/privacy}","received_events_url":"https://api.github.com/users/abelsromero/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-01-11T11:46:12Z","updated_at":"2016-01-18T18:36:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/asciidoctor/asciidoctor-maven-plugin/pulls/193","html_url":"https://github.com/asciidoctor/asciidoctor-maven-plugin/pull/193","diff_url":"https://github.com/asciidoctor/asciidoctor-maven-plugin/pull/193.diff","patch_url":"https://github.com/asciidoctor/asciidoctor-maven-plugin/pull/193.patch"},"body":"**PR description**\r\nThis PR is a preview of a solution for issues #174 and #187.\r\nBoth issues highlighted the limitations in terms of sources and resources management of the maven plugin.\r\nFollowing the recomendation of Dan on isue #174\r\n```\r\nAgreed. We should align with the Gradle plugin on this one.\r\nSee https://github.com/asciidoctor/asciidoctor-gradle-plugin#usage (sources)\r\n```\r\nthis PR includes the following changes:\r\n(1). `sourceDirectory`, `sourceDocumentName` & `sourceDocumentExtension` disappear in favour of two new options sources & resources.\r\n(2). `sources`: follows a the same resource pattern as the [maven-resource-plugin](https://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html). Basically it uses the same underlying API (https://maven.apache.org/shared/maven-filtering/). The difference here is that filtering/replacement options are not available and by default only AsciiDoc files are included.\r\nRendered files can be modified using custom include and exclude filters. This includes, adding more sources files with custom file extensions, adding multiple files, directories, etc.\r\n(3). `resources`: follows the same resources pattern [...]. If not set, all resources (images, css, etc.) in the different sources are copied. This is different to how the gradle plugin works, but is consistent with how the current maven plugn works. Also, all source files defined using `include` conditions are excluded by default. In this case, the filtering (a.k.a. replacement) options provided by the maven-resource-plugin can be used, I would not advertise them.\r\nAll of this can be modified using custom include and exclude filters. For instance, if someone wants to copy AsciiDoc documents to the target folder, just create a <resource> tag like this one:\r\n```\r\n<resource>\r\n    <directory>DIRECTORY</directory>\r\n    <include>**/*.adoc</>\r\n    <include>**/*.asciidoc</>\r\n</resource>\r\n```\r\n\r\n(4). Options related to the output (format and directory) are kept 'global', that is, at <configuration> level as now. To some degree it makes sense to define them in the source element, but in my opinion this is just re-implementing maven executions inside the plugin. This includes options like `outputDirectory`, `baseDir`, `backend`, `preserveDirectories`, etc.\r\nThe criteria I followed was:\r\n * You need to manage several inputs? Now you can :)\r\n * You need to manage multiple outputs? You should use different executions. In the same way in gradle you would define a different task.\r\nBut eventually, this could be implemented if the community asks for it. But this will mean that resources will a property inside each source.\r\n\r\n**Next steps**\r\n* Le'ts discuss this and please let me know of corner cases to test. There's quite a lot of include/exclude manipulation and I suspect I may have slipt some special case.\r\nI have separated working code and test to ease the review. I'll merge them on the final PR.\r\n* Documentation is missing, once we have the final approach I'll include it.\r\n* Decide version: this is a major change with no backward compatibility. Should we save it for 1.6.0 and use 1.5.4/5 for urgent fixes?\r\n* Improve and document the refresh mojo: right now I did a quick approach 'that works' but can consume lots of resources in some cases. I keep that for a separated PR.\r\n\r\n* @marcaurele, to render the files in the root (README, CONTRIBUTING, etc.), you can do something like this:\r\n```\r\n<sources>\r\n    <source>\r\n        <directory>.</directory>\r\n        <include>*.adoc</include> <!-- only includes files in 'directory' property, not sub-directories -->\r\n    </source>\r\n</sources>\r\n<resources>\r\n    <resource>\r\n        <directory>.</directory>\r\n        <exclude>**/**</exclude> <!-- does not copy anything -->\r\n    </resource>\r\n</resources>\r\n```\r\nor include each file one by one with differnt include tags. _Let me lnow what do you think_\r\n\r\n* @AlexanderZobkov please, let me know if this approach helps you.\r\n\r\n\r\n_I think that's all, thanks for you patience if you got here_"},"comment":{"url":"https://api.github.com/repos/asciidoctor/asciidoctor-maven-plugin/issues/comments/172618648","html_url":"https://github.com/asciidoctor/asciidoctor-maven-plugin/pull/193#issuecomment-172618648","issue_url":"https://api.github.com/repos/asciidoctor/asciidoctor-maven-plugin/issues/193","id":172618648,"user":{"login":"abelsromero","id":5781153,"avatar_url":"https://avatars.githubusercontent.com/u/5781153?v=3","gravatar_id":"","url":"https://api.github.com/users/abelsromero","html_url":"https://github.com/abelsromero","followers_url":"https://api.github.com/users/abelsromero/followers","following_url":"https://api.github.com/users/abelsromero/following{/other_user}","gists_url":"https://api.github.com/users/abelsromero/gists{/gist_id}","starred_url":"https://api.github.com/users/abelsromero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abelsromero/subscriptions","organizations_url":"https://api.github.com/users/abelsromero/orgs","repos_url":"https://api.github.com/users/abelsromero/repos","events_url":"https://api.github.com/users/abelsromero/events{/privacy}","received_events_url":"https://api.github.com/users/abelsromero/received_events","type":"User","site_admin":false},"created_at":"2016-01-18T18:36:27Z","updated_at":"2016-01-18T18:36:27Z","body":"Any comment on this? @mojavelinux, @LightGuard ?"}}