Prevent both dir and jar. Add tests