Choose main artifact by packaging

Trying to go forward with [this forum post](http://forums.gradle.org/gradle/topics/how_to_publish_a_jar_and_a_jpi_file_at_the_same_time) I created an initial pull request to address the feature. I will also wrote an email to the dev list: https://groups.google.com/forum/#!topic/gradle-dev/upMmzgzTdBc. See also https://issues.jenkins-ci.org/browse/JENKINS-25007.