[GRADLE-3162] IvyPublication.configurations{} does not create configurations Created: 05/Sep/14  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 1


hi there

I'm trying to publish a jar , well actually 3 jars - classes,sources and javadoc,by using plugin 'ivy-publish'. But executing 'gradle publish' always ends in:

> Could not parse Ivy file file:/C:/dev/ie8-git/services/restgenericclient/build/publications/ivyJava/ivy.xml
> Problem occurred while parsing ivy file: Cannot add artifact 'iengine-service-restgenericclient.jar(sources)' to configuration 'sources' of module tie#iengine-service-restgenericclient;1.0.0 because this configuration doesn't exist!

build.gradle looks as following ->

apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'ivy-publish'

group = 'tie'
version = '1.0.0'
archivesBaseName = 'iengine-service-restgenericclient'

compileJava {
sourceCompatibility = 1.6
targetCompatibility = 1.6

jar {
manifest {
attributes 'Implementation-Title': 'REST Generic Client',
'Implementation-Version': version

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir

artifacts {
archives sourcesJar
archives javadocJar

repositories {

dependencies {
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'org.springframework:spring-web:4.0.6.RELEASE'
compile 'org.apache.httpcomponents:httpclient:4.3.5'

compile 'com.fasterxml.jackson.core:jackson-core:2.4.2'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.2'

testCompile 'junit:junit:4.11'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile 'org.mockito:mockito-all:1.9.5'

publishing {

publications {
ivyJava(IvyPublication) {
module archivesBaseName
from components.java
artifact(sourcesJar) {
type "sources"
conf "sources"
artifact(javadocJar) {
type "javadoc"
conf "javadoc"

generated xml

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="tie" module="iengine-service-restgenericclient" revision="1.0.0" status="integration" publication="20140903223020"/>
<conf name="default" visibility="public" extends="runtime"/>
<conf name="runtime" visibility="public"/>
<artifact name="iengine-service-restgenericclient" type="jar" ext="jar" conf="runtime"/>
<artifact name="iengine-service-restgenericclient" type="sources" ext="jar" conf="sources" m:classifier="sources"/>
<artifact name="iengine-service-restgenericclient" type="javadoc" ext="jar" conf="javadoc" m:classifier="javadoc"/>
<dependency org="org.apache.commons" name="commons-lang3" rev="3.3.2" conf="runtime->default"/>
<dependency org="org.springframework" name="spring-web" rev="4.0.6.RELEASE" conf="runtime->default"/>
<dependency org="org.apache.httpcomponents" name="httpclient" rev="4.3.5" conf="runtime->default"/>
<dependency org="com.fasterxml.jackson.core" name="jackson-core" rev="2.4.2" conf="runtime->default"/>
<dependency org="com.fasterxml.jackson.core" name="jackson-databind" rev="2.4.2" conf="runtime->default"/>
<dependency org="com.fasterxml.jackson.core" name="jackson-annotations" rev="2.4.2" conf="runtime->default"/>

Does anybody know how to publish sources & javadoc artefact to my ivy repository?

thanks for help.

Comment by Gradle Forums [ 05/Sep/14 ]

The error is because you are specifying configurations for the artifacts ("sources" and "javadoc") that don't exist. You should use one of the existing configurations unless you have a reason to use a separate configuration. The "runtime" configuration is probably what you want.

Comment by Gradle Forums [ 05/Sep/14 ]

Thanks for your answer. I'd like to seperate "runtime" from "sources" configuration. For example in ivy.xml of aopalliance in my local gradle cache (C:\Users\tiezad\.gradle\caches\modules-

2\metadata-2.12\descriptors\aopalliance\aopalliance\1.0\8eb80c2e7e631bf662f14a25bb19e6c0) those two configurations are seperated as well.

<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="aopalliance" module="aopalliance" revision="1.0" status="release" publication="20070226234340">
<license name="Public Domain"/>
<description homepage="http://aopalliance.sourceforge.net">AOP Alliance</description>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation

classpath, and is not transitive."/>
<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths,

but not the compile classpath." extends="compile"/>
<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation

and execution phases." extends="runtime"/>
<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and

is not looked up in a repository."/>
<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
<conf name="optional" visibility="public" description="contains all optional dependencies"/>
<artifact name="aopalliance" type="jar" ext="jar" conf="master"/>
<artifact name="aopalliance" type="source" ext="jar" conf="sources" m:classifier="sources"/>

Is it possible to add this configuration "sources"?

Comment by Gradle Forums [ 05/Sep/14 ]

You should just be able to define those configurations then:


{ sources javadoc }
Comment by Gradle Forums [ 05/Sep/14 ]

Still same error.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':publishIvyJavaPublicationToIvyRepository'.
    > Failed to publish publication 'ivyJava' to repository 'ivy'
    > Could not parse Ivy file file:/C:/dev/ie8-git/services/restgenericclient/build/publications/ivyJava/ivy.xml
    > Problem occurred while parsing ivy file: Cannot add artifact 'iengine-service-restgenericclient.jar(source)' to configuration 'sources' of module tie#iengine-service-restgenericclient;1.0.0 because this configuration doesn't exist!

I've found a workaround.


{ asNode().configurations[0].appendNode('conf', [name: 'sources', visibility: 'public']) asNode().configurations[0].appendNode('conf', [name: 'javadoc', visibility: 'public']) }

This way I can add those two configurations manually to ivy.xml.

Comment by Gradle Forums [ 05/Sep/14 ]

Could it be that ivy-plugin doesn't support other configurations than default & runtime?

Comment by Gradle Forums [ 05/Sep/14 ]

Looks like a defect. You can work around it as such:

publications {
ivyJava(IvyPublication) {
from components.java


{ conf "sources" classifier "sources" }


Comment by Gary Hale [ 05/Sep/14 ]

The following doesn't work on IvyPublication:

configurations {
sources { }

But this does:


Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:41:35 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.