Conversion from Maven can't handle a variable in a system path

Gradle 1.7-rc-2

$ gradle setupBuild :wrapper :setupBuild Maven to Gradle conversion is an incubating feature. :setupBuild FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:setupBuild’. > Could not convert Maven POM /Users/scott/dev/Project/ProjectCore_sync/pom.xml to a Gradle build.

Unable to create Maven project model using POM /Users/scott/dev/Project/ProjectCore_sync/pom.xml.

Some problems were encountered while processing the POMs:

[ERROR] ‘dependencyManagement.dependencies.dependency.systemPath’ for javafx:jfxrt:jar must specify an absolute path but is ${java.home}/lib/jfxrt.jar @ line 340, column 17

This is used to reference the JavaFX JAR as distributed in Java 7. The jar is present in the JRE but not by default on the classpath so it must be added as a system dependency to be available to Maven projects.

The result of evaluating ${java.home} in Maven of course evaluates to an absolute path. Gradle doesn’t understand this, but it is a basic variable that it should probably convert automatically.

This seems to be a general problem processing the POM during conversion…

  • What went wrong: Execution failed for task ‘:setupBuild’. > Could not convert Maven POM /Users/scott/dev/Project/ProjectCore_sync/pom.xml to a Gradle build.

    Unable to create Maven project model using POM /Users/scott/dev/Project/ProjectCore_sync/pom.xml.

    Some problems were encountered while processing the POMs:

[ERROR] ‘build.plugins.plugin[org.gradle.mvn3.org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.systemPath’ for com.sun:tools:jar must specify an absolute path but is ${java.tools.jar} @ example.domain:drc-parent:1.2.26, /Users/scott/.m2/repository/example/domain/drc-parent/1.2.26/drc-parent-1.2.26.pom, line 153, column 20

[ERROR] ‘build.plugins.plugin[org.gradle.mvn3.org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.version’ for com.sun:tools:jar must be a valid version but is ‘${java.version}’. @ example.domain:drc-parent:1.2.26, /Users/scott/.m2/repository/example/domain/drc-parent/1.2.26/drc-parent-1.2.26.pom, line 151, column 17

[ERROR] ‘build.plugins.plugin[org.gradle.mvn3.org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.systemPath’ for com.sun:tools:jar must specify an absolute path but is ${java.tools.jar} @ example.domain:drc-parent:1.2.26, /Users/scott/.m2/repository/example/domain/drc-parent/1.2.26/drc-parent-1.2.26.pom, line 153, column 20

[ERROR] ‘build.plugins.plugin[org.gradle.mvn3.org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.version’ for com.sun:tools:jar must be a valid version but is ‘${java.version}’. @ example.domain:drc-parent:1.2.26, /Users/scott/.m2/repository/example/domain/drc-parent/1.2.26/drc-parent-1.2.26.pom, line 151, column 17

The sad thing is that when I changed this to a path without a variable to see if I could get any farther, I got this error:

[WARNING] ‘dependencyManagement.dependencies.dependency.systemPath’ for javafx:jfxrt:jar should use a variable instead of a hard-coded path /Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/jre/lib/jfxrt.jar …

You are right; it looks like POM conversion can’t handle Maven property expressions. (I guess the warning comes from Maven.) I’ve raised GRADLE-2872 to track this.

do you have a small reproducible example of that issue?

I don’t have an example at hand that I can share. It shouldn’t be hard to reproduce. Just make a POM with a system dependency that uses a property in the path. In my case the property was defined in a parent POM.