{"action":"created","issue":{"url":"https://api.github.com/repos/lukehutch/fast-classpath-scanner/issues/79","repository_url":"https://api.github.com/repos/lukehutch/fast-classpath-scanner","labels_url":"https://api.github.com/repos/lukehutch/fast-classpath-scanner/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/lukehutch/fast-classpath-scanner/issues/79/comments","events_url":"https://api.github.com/repos/lukehutch/fast-classpath-scanner/issues/79/events","html_url":"https://github.com/lukehutch/fast-classpath-scanner/issues/79","id":177213020,"number":79,"title":"Feature request: Optionally exclude test classes from scan","user":{"login":"smillies","id":8183111,"avatar_url":"https://avatars.githubusercontent.com/u/8183111?v=3","gravatar_id":"","url":"https://api.github.com/users/smillies","html_url":"https://github.com/smillies","followers_url":"https://api.github.com/users/smillies/followers","following_url":"https://api.github.com/users/smillies/following{/other_user}","gists_url":"https://api.github.com/users/smillies/gists{/gist_id}","starred_url":"https://api.github.com/users/smillies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillies/subscriptions","organizations_url":"https://api.github.com/users/smillies/orgs","repos_url":"https://api.github.com/users/smillies/repos","events_url":"https://api.github.com/users/smillies/events{/privacy}","received_events_url":"https://api.github.com/users/smillies/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-15T15:43:27Z","updated_at":"2016-09-19T06:57:42Z","closed_at":null,"body":"I am dynamically creating a whitelist of classes from some packages in my Maven project. Of course, in the development environment the project also has the test classes on the classpath. However, the whitelist should not include anything under target/test/...\r\n\r\nIt would be nice if there were some way to limit scanning to specific _directories_ on the classpath (e. g. to target/main/classes), just as there is a syntax to limit scanning to jar files.\r\n\r\n-- Sebastian"},"comment":{"url":"https://api.github.com/repos/lukehutch/fast-classpath-scanner/issues/comments/247922360","html_url":"https://github.com/lukehutch/fast-classpath-scanner/issues/79#issuecomment-247922360","issue_url":"https://api.github.com/repos/lukehutch/fast-classpath-scanner/issues/79","id":247922360,"user":{"login":"smillies","id":8183111,"avatar_url":"https://avatars.githubusercontent.com/u/8183111?v=3","gravatar_id":"","url":"https://api.github.com/users/smillies","html_url":"https://github.com/smillies","followers_url":"https://api.github.com/users/smillies/followers","following_url":"https://api.github.com/users/smillies/following{/other_user}","gists_url":"https://api.github.com/users/smillies/gists{/gist_id}","starred_url":"https://api.github.com/users/smillies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smillies/subscriptions","organizations_url":"https://api.github.com/users/smillies/orgs","repos_url":"https://api.github.com/users/smillies/repos","events_url":"https://api.github.com/users/smillies/events{/privacy}","received_events_url":"https://api.github.com/users/smillies/received_events","type":"User","site_admin":false},"created_at":"2016-09-19T06:57:42Z","updated_at":"2016-09-19T06:57:42Z","body":"Yes, I think you're right. The one complication is when I create whitelists for a productive system not at runtime but during the Maven Build, and target/test is visible. As a matter of principle, you don't want test classes in production code, not even their names. And you cannot exclude unit test packages based on their names, after all, they are the same names as the productive packages.\r\n\r\nThere are several ways to work around that: overriding the classpath of the scanner, as you mentioned, or calling an Ant task with a modified classpath, and probably others. \r\n\r\nPerhaps easier than introducing directory regexes would be to exclude classes with a name matching \"*Test\". There is already something that can do that: the `FastClasspathScanner#matchFilenamePattern` family of methods. It would be nice if one could use this mechanism for matching only, instead of having to pass in a `FileMatchProcessor` that actually opens a stream to the file.\r\n"}}
{"actor":{"display_login":"smillies"}}