How to include an externally compiled project as a dependency?


(Ben A Kushigian) #1

First, sorry if this is a dumb question–I’m trying out Gradle for the first time and I’ve immediately run into this issue. I’m not sure what to search for to resolve it.

The Issue

I’m working on a project in Java that has a few external dependencies. One of these is Microsoft’s Z3 solver which is written in C++ and can optionally be compiled with Java bindings (in which case a jar is exported).

The location of z3 will change between different users, which precludes a hard-coded path to the jar.

My Questions

  1. Is there a standard way to deal with this such that the Z3 project can be built/compiled automatically (maybe pulled from github if necessary)?
  2. If (1) is not possible, what is the accepted method for specifying the jar location? I’d like this to play nicely with version control, so I cannot hard code it into build.gradle.
    • One thought is to create a z3-setup.gradle with z3_jar_path = "enter/your/z3/jar/path/here", add it to VCS and then to .gitignore so that subsequent user updates aren’t tracked in the repo.