[GRADLE-948] Archive Task does not support type field Created: 27/May/10  Updated: 04/Jan/13  Resolved: 24/Nov/10

Status: Resolved
Project: Gradle
Affects Version/s: 0.9
Fix Version/s: 0.9-rc-1

Type: Bug
Reporter: Gretar Rafn Arnason Assignee: Hans Dockter
Resolution: Fixed Votes: 0

Issue Links:
dependent on GRADLE-959 Make PublishArtifacts configurable Resolved


when creating a new jar type task I want to be able to set the type to 'source'
task jarSource(type: Jar){
type = 'source'
classifier = 'src'

and then publish using ivy pattern <somedir>/[organization]/[module]/[type]s/[artifact](-[classifier]).[ext]

Currently this does not give expected result (that is type substituted in pattern is actually value of extension) -> both source and classes jar is put into folder .../jars/*.jar

Suggested fix:
add type field in class org.gradle.api.tasks.bundling.AbstractArchiveTask
then change method getType in org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact to use this field instead of extension eg (note it is probably worth though to clean up the following code snippet
public String getType() {
if (archiveTask.getType() != null && !archiveTask.getType().equals(""))
return archiveTask.getType();
return archiveTask.getExtension();

I would be highly appreciated to include this simple fix in version 0.9 release.

Comment by Gretar Rafn Arnason [ 27/May/10 ]

of course something goes wrong when you don't read over before submitting:
Errata: ...I would be highly appreciated to include this simple fix in... -> ...I would highly appreciate that it be included in...

Comment by Hans Dockter [ 08/Jun/10 ]

You can now do:

artifacts {

{ type = 'source' }


Generated at Wed Jun 30 11:42:59 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.