Gradle - Quick Start¶
Gradle is InterMine’s build tool. In InterMine 2.0 Gradle replaced ant.
Please see Upgrade instructions for details on how to migrate your system to use Gradle and Gradle FAQs for commonly asked questions about Gradle.
Below are common commands you will use when building InterMine database and deploying webapps. See docs.gradle.org for the full list.
Data sources¶
Previously all third party JARs were kept in the InterMine code repository and the build compiled all InterMine dependencies. Now, Gradle, via the Maven plugin, manage and download all JARs and only your local project is compiled.
To use local data sources
~/git/flymine-bio-sources $ ./gradlew install
- See the maven plugin docs on the install task for details.
- Example: https://github.com/intermine/flymine-bio-sources - FlyMine-specific data sources.
- When installed locally, the JAR that is produced is available in the maven repo located in ~/.m2/repository
- The JARs downloaded as dependencies are available in the Gradle cache, ~/.gradle/caches/modules-2/files-2.1/.
Note
The build is going to be looking at the resulting JAR created by this command. If you make any changes to your data sources, install again to update the JAR to make those changes visible to the build.
To use common data sources in the InterMine library
- No action required. Use project XML file as normal.
The migration script you used set up the dependency to the intermine-bio-sources project already. This project includes uniprot and other data sources, and are on the classpath. During the build, the code will look for the uniprot jar, e.g. bio-source-uniprot-2.0.jar and find it on the classpath successfully. Maven will download it for you.
Database¶
Delete and recreate all database tables
~/git/flymine $ ./gradlew buildDB
Delete and recreate all database tables using a specific property file.
~/git/flymine $ ./gradlew buildDB -Dorg.gradle.project.release=dev
To run a single source
~/git/flymine $ ./gradlew integrate -Psource=uniprot --stacktrace
Note
You can try –info or –debug too
To run a single postprocess
~/git/flymine $ ./gradlew postprocess -Pprocess=do-sources --stacktrace
To run a full build
~/git/flymine $ ./project_build -b localhost /tmp/flymine-dump
We are using the same project build script, but we’ve moved it to the intermine-scripts repository with our other scripts.
Webapp¶
There are several ways to deploy your InterMine webapp. You can use cargo to deploy your webapp to a running Tomcat instance, or gretty to use an embedded Tomcat instance. Run ./gradlew tasks to see all the available tasks.
We use cargo for our production instances and gretty on our local dev machines.
Deploy a webapp (cargo)¶
~/git/flymine $ ./gradlew cargoDeployRemote
~/git/flymine $ ./gradlew cargoRedeployRemote
~/git/flymine $ ./gradlew cargoUndeployRemote
Uses the config in the mine properties file, e.g. flymine.properties, to deploy the webapp, see below.
Property name | Example | Determines |
---|---|---|
webapp.hostname | localhost | name of host. If not set, tries to use webapp.deploy.url |
webapp.path | flymine | location of path of webapp |
webapp.manager | TOMCAT_USER | tomcat username, needed to deploy webapp |
webapp.password | TOMCAT_PWD | tomcat password, needed to deploy webapp |
webapp.protocol | https | OPTIONAL, defaults to http |
webapp.port | 8081 | OPTIONAL, defaults to 8080 |
Warning
Cargo uses hot deployment which over time fills up the PermGen memory of the JVM process running your container. Continuously deploying an artifact will inevitablity lead to a java.lang.OutOfMemoryError
Deploy a webapp (gretty)¶
~/git/flymine $ ./gradlew tomcatStartWar
~/git/flymine $ ./gradlew tomcatStop
- Embedded tomcat, uses port 8080.
- Logs are in $HOME/logs, for more details: http://akhikhl.github.io/gretty-doc/Logging.html
Deploy blue genes¶
~/git/flymine $ ./gradlew blueGenesStart
- Gets the mine name, URL and tools location from the $mine.properties file.
- Uses the webservices from the webapp specified in the $mine.properties file. For the time being, you have to have an InterMine webapp running to launch a bluegenes instance.
- The app will be deployed at the specified URL, port 5000.
- It is suggested to launch the app in the background (append & to the command).
- Please see Blue genes for details on how to configure your bluegenes instance.
Specify properties file¶
To use a specific properties file, set the file suffix with the -Dorg.gradle.project.release parameter like so:
~/git/flymine $ ./gradlew builddb -Dorg.gradle.project.release=dev
That command will build the database set in the flymine.properties.dev file.
Gradle¶
To see a list of command-line options, run
./gradlew --help
To see what tasks are available
./gradlew tasks
To get rid of compiled files
./gradlew clean
To update your local packages
./gradlew install
- See Local installation for how to install InterMine locally. (You shouldn’t do this normally, instead use the JARs available via Maven).
- Always use ./gradlew instead of gradle. This is the wrapper that comes with InterMine and ensure that everyone is using the same version.
Daemons¶
The updated Gradle version comes with daemons enabled by default. These are helper processes that exist in the background. This can speed up builds for example but sometimes, under heavy development, can cause problems when InterMine does not properly dereference assets. We are working on fixing this! In the meantime, you should append -Dorg.gradle.daemon=false to your GRADLE_OPTS variable.
- See: Daemon docs