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


(Scott Palmer) #1

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.


(Scott Palmer) #2

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


(Scott Palmer) #3

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 …


(Peter Niederwieser) #4

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.


(René Groeschke) #5

do you have a small reproducible example of that issue?


(Scott Palmer) #6

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.