Issue with Gradle 1.0 m6 publish artifact handling

Hi guys,

In recent Gradle there is this handling of all published artifacts, which adds any ‘jar’ artifact as a candidate for the ‘archives’ configuration as well.

My project needs to define archive publication artifacts of different type (e.g. ‘foo’), but this does not work well since the published artifacts are configured after they are added to the configuration’s artifacts, e.g:

Jar fooArtifactProducer = ...
project.artifacts.add 'myConf', fooArtifactProducer, { type = 'foo'}

This works, but since at the time the artifact is added to the underlying container, its type is still ‘jar’, it is also handled by the default artifacts handling (‘BasePlugin#configureConfigurations()’), adding it to the ‘archives’ configuration which I would like to avoid.

I use the following workaround for now:

PublishArtifact fooArtifact = new ArchivePublishArtifact(fooArtifactProducer)
fooArtifact.type = 'foo'
project.artifacts.add 'myConf', fooArtifact

But this forces me to use the internal ‘ArchivePublishArtifact’ which I would like to avoid.

A potential fix is to configure the publish artifact with the provided closure prior to adding it to the underlying store.

Or maybe add a factory method in ‘ArtifactHandler’ for creating ‘ArchivePublishArtifact’ instances?