Sikuli error with build.gradle

Asked by chandan

Hi guys ,

I am using selenium webdriver in conjunction with cucumber. I am running my project with build.gradle

My problem is that i am able to run my project through eclipse but i am not aware how to add dependency in build.gradle for sikuli script. This is the code where i am using sikuli

import org.sikuli.script.FindFailed;
import org.sikuli.script.Pattern;
import org.sikuli.script.Screen;

public pageflash() throws InterruptedException{
  Screen screen = new Screen();
  Pattern image = new Pattern("src/takeSnapShot.png");
  try {
   screen.wait(image, 15);
  } catch (FindFailed e) {

   e.printStackTrace();
  }
  try {
   screen.click(image);
  } catch (FindFailed e) {
   e.printStackTrace();
  }

  return this;

 }
This is the error that i am getting

page.java:7: error: package org.sikuli.script does not exist
import org.sikuli.script.FindFailed;

Please let me know how to import sikuli dependency in build.gradle.

Thanks in advance

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

How do you add other dependencies to build.gradle?

Should be the same with sikuli-java.jar.

Revision history for this message
chandan (chandandeep-er) said :
#2

i have tried following

compile "org.sikuli:sikuli-api:1.0+"
    compile "org.sikuli:sikuli-java:1.0.1"
 compile "org.sikuli:sikuli-core:1.1.4"
 compile "edu.mit.csail.uid.sikuli:sikuli-script:1.0-SNAPSHOT"

but no success.

Revision history for this message
chandan (chandandeep-er) said :
#3

first is that i should add sikuli-script or sikuli-java.jar?
then question is that how should i add these

Revision history for this message
RaiMan (raimund-hocke) said :
#4

nothing to compile for Sikuli. sikuli-java.jar is ready to be used.

You have to put sikuli-java.jar on the class path for the compile step of your stuff.

Revision history for this message
chandan (chandandeep-er) said :
#5

@raiman

putting sikuli-java.jar in classpath means i need to have this in project itself, which is not recomenended to us. I need to get this from maven repo. . Putting the .jar in project is making it very heavy.

Revision history for this message
RaiMan (raimund-hocke) said :
#6

ok, understood.

Cant you transfer it to your local Maven repo using a minimum pom.xml?

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.sikuli</groupId>
<artifactId>sikuli-java</artifactId>
 <version>1.0.1</version>

<name>sikuli-java</name>

</project>

Revision history for this message
chandan (chandandeep-er) said :
#7

RaiMan (raimund-hocke)
Thanks for your help. but i need this in build.gradle version to which i am new. can you please convert this in .gradle template and let me know . we are not using pom.xml. rather we are using build.gradle

Revision history for this message
RaiMan (raimund-hocke) said :
#8

Sorry, but it is beyond the scope of this board, to compensate your lack of knowledge with a tool you decided to use.

When you are using Gradle, then you should be able to integrate a ready jar from a central place into your workflow.

BTW: you said: I need to get this from maven repo.
... then you should be familiar with the basics of poms and have a local Maven repo.

Can you help with this problem?

Provide an answer of your own, or ask chandan for more information if necessary.

To post a message you must log in.