[request] Java: to support Gradle: Stop using property variables in POM

Bug #1410072 reported by David
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Medium
RaiMan

Bug Description

Gradle cannot currently resolve SikuliX 1.1.0-SNAPSHOT because of this line "<artifactId>${sikulix.libs}</artifactId>."

> Could not find com.sikulix:${sikulix.libs}:1.1.0-SNAPSHOT.
  Searched in the following locations:
      http://repo1.maven.org/maven2/com/sikulix/$%7Bsikulix.libs%7D/1.1.0-SNAPSHOT/maven-metadata.xml
      http://repo1.maven.org/maven2/com/sikulix/${sikulix.libs}/1.1.0-SNAPSHOT/${sikulix.libs}-1.1.0-SNAPSHOT.pom
      http://repo1.maven.org/maven2/com/sikulix/${sikulix.libs}/1.1.0-SNAPSHOT/${sikulix.libs}-1.1.0-SNAPSHOT.jar
      https://oss.sonatype.org/content/groups/public/com/sikulix/$%7Bsikulix.libs%7D/1.1.0-SNAPSHOT/maven-metadata.xml
      https://oss.sonatype.org/content/groups/public/com/sikulix/${sikulix.libs}/1.1.0-SNAPSHOT/${sikulix.libs}-1.1.0-SNAPSHOT.pom
      https://oss.sonatype.org/content/groups/public/com/sikulix/${sikulix.libs}/1.1.0-SNAPSHOT/${sikulix.libs}-1.1.0-SNAPSHOT.jar

Gradle does not resolve variables in POM files and discourages their use. http://forums.gradle.org/gradle/topics/handling_properties_in_maven_pom

Sample gradle file:
apply plugin: 'java'
apply plugin: 'idea'

repositories {
    mavenCentral()
    maven {
        url "http://maven2.javacpp.googlecode.com/git/"
        url "https://oss.sonatype.org/content/groups/public"
    }
}

dependencies {
    testCompile group: 'com.sikulix', name: 'sikulixapi', version: '1.1.0-SNAPSHOT'
}

Version used: 1.1.0-SNAPSHOT
64-Bit Ubuntu 14.04
Java 1.7.0_72 64-Bit
Gradle 2.0

RaiMan (raimund-hocke)
summary: - [request] Stop using variables in POM
+ [request] Java: to support Gradle: Stop using property variables in POM
Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 2.0.0
Revision history for this message
RaiMan (raimund-hocke) wrote :

Interesting - thanks.

I will not fix this for 1.1.0 (the native library package is selected this way based on the system we are running on).

The only workaround currently is to use setup to get a packed sikulixapi.jar for your system and use this in your Gradle setup.

On Linux systems generally one will usually get problems with the stuff from Maven, since in many cases the bundled libVisionProxy.so does not work (wrong or missing dependencies) and has to be built and packed using setup anyway.

So one currently has to live with that.
Version 2 will surely improve the situation, since I plan to switch to Gradle anyway and to reduce the dependencies on native libraries.

Revision history for this message
David (dburban) wrote :

Thanks Raimund for taking a look at this. I will use the workaround until v2.

Revision history for this message
Goncalo Soares (gunzosoares) wrote :

Another workaround using default Gradle functionality is possible.

Like this:

compile ('com.sikulix:sikulixapi:1.1.0') {
        exclude module: '${sikulix.libs}'
    }
    switch(System.getProperty('os.name').toLowerCase().split()[0]) {
        case 'windows':
            compile group: 'com.sikulix', name: 'sikulixlibswin', version: '1.1.0'
            break
        case 'linux':
            compile group: 'com.sikulix', name: 'sikulixlibslux', version: '1.1.0'
            break
        case 'mac':
            compile group: 'com.sikulix', name: 'sikulixlibsmac', version: '1.1.0' // MAC
            break
        default:
            throw new Exception('Unknown OS')
    }

Hope it helps!
Goncalo

RaiMan (raimund-hocke)
Changed in sikuli:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.