"Illegal character in path at index 73" when downloading dependency from maven

I have created simple gradle scirpt:

apply plugin: ‘java’ apply plugin: ‘eclipse’ apply plugin: ‘maven’

repositories {

maven {

url “http://maven.xxxx.com/content/groups/all

} } dependencies {

compile ‘com.xxxxx.xxx:xxx-core:12.3.4’ }

When I run “gradle compileJava” I get error “java.net.URISyntaxException: Illegal character in path at index 73: http://maven.xxxxx.com/content/groups/all/com/xxxxx/xxx/xxx-core/12.3.4/${artifact.id}-12.3.4.${packaging.type}” I get this error on Windows 7 in Gradle 1.5, 1.6 and 1.7-rc-1

The same configuration (repository + dependency) works for Maven.

Full stack trace available at: https://gist.github.com/otros-systems/2291d1cb4c55bbf4d0b3

I suspect you have ${artifact.id} in your dependency notation. The string is in single quotes so this will be interpreted literally.

What do you mean by " ${artifact.id} in your dependency notation." Where I can check this?

The whole scripts i pasted in question.


dependencies {
   compile 'com.xxxxx.xxx:xxx-core:12.3.4'

Is there an ${artifact.id} in what’s x’d out?

There is no ${artifact.id}. I have replaced with ‘x’ name of company internal library (only a-z chars).

These lines:

14:24:56.966 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] Downloading http://maven.xxxxx.com/content/groups/all/com/xxxxx/xxx/xxx-core/12.3.4/xxx-core-12.3.4.pom to C:\Users\xxxxxx\AppData\Local\Temp\gradle_download405554618854995788bin14:24:57.075 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] Loading http://maven.xxxxx.com/content/groups/all/com/xxxxx/xxx/xxx-core/12.3.4/${artifact.id}-12.3.4.${packaging.type}
14:24:57.083 [DEBUG] [org.gradle.api.internal.externalresource.transport.http.HttpResourceAccessor] Constructing external resource metadata: http://maven.xxxxx.com/content/groups/all/com/xxxxx/xxx/xxx-core/12.3.4/${artifact.id}-12.3.4.${packaging.type}

Does that POM have ${artifact.id} in it?

Yes, project artifact id is ${artifact.id} and packaging type is ${packaging.type}. <project …>





That’s the problem. Gradle doesn’t expand such tokens in POM files on resolution.

At this time, there is no plan to support this as it has severe impacts on dependency resolution performance.

While Maven does support tokens in published POMs, it is discouraged for the same reason.

I’m trying to convert a large multi-module maven build to use gradle. I’m running into this problem with a dependency POM. It’s an external dependency, so I don’t have the option of changing the POM to not use variable substitutions.

> Illegal character in path at index 65:${cglib.version}/cglib-${cglib.version}.pom

Is there a known workaround for this?

Bump, we have the exact same problem. What is a good workaround?

Presumably the only work around is to copy the artifacts to your own repository and edit the pom by hand to expand the properties. Rather tedious.

How wide spread is this?

I have just encountered it with Apache HttpClient 4.1.2 and 4.2.5.


I had the same problem: http://forums.gradle.org/gradle/topics/how_to_fix_pom_xml_for_a_downloaded_resolved_dependency\

and I ended up with uploading the artifact items to our nexus repository with custom version suffix and forcing those “fixed” artifacts:

allprojects {

configurations.all { configuration ->

resolutionStrategy {

eachDependency {

if (requested.name == ‘jdo2-api’ && requested.version == ‘2.2’) {

useVersion ‘2.2.MY_FIX’ // custom version with correct pom.xml