A java integration library for AeroGear Digger
Project Info | |
---|---|
License: | Apache License, Version 2.0 |
Build: | Maven |
Documentation: | https://github.com/aerogear/digger-java |
Issue tracker: | https://issues.jboss.org/browse/AGDIGGER |
Mailing lists: | aerogear-users (subscribe) |
aerogear-dev (subscribe) | |
IRC: | #aerogear channel in the freenode network. |
For now, clone the repository and run the build:
mvn clean install
Add the following dependencies to your pom.xml
file:
<dependency>
<groupId>org.jboss.aerogear</groupId>
<artifactId>digger-java-client</artifactId>
<version>1.1.0</version>
</dependency>
Build a default client:
DiggerClient client = DiggerClient.createDefaultWithAuth("https://digger.com", "admin", "password");
Build a customized client:
DiggerClient client = DiggerClient.builder()
.jobService(new JobService())
.buildService(new BuildService(10000, 100))
.artifactsService(artifactsService)
.withAuth("https://digger.com", "admin", "password")
.build();
Create job:
client.createJob("java-client-job1","https://github.com/wtrocki/helloworld-android-gradle","master");
The client supports setting clean-up values for jobs in relation to the number of days to store builds and artifacts and the total number of builds and artifacts to keep.
Create a job with clean-up policy:
import org.aerogear.digger.client.model.BuildDiscarder
BuildDiscarder buildDiscarder = new BuildDiscarder();
buildDiscarder.setStoreBuildsDays(7)
client.createJob("java-client-job1","https://github.com/wtrocki/helloworld-android-gradle","master", buildDiscarder);
The client supports passing a list of build parameters. To create a job with build params:
import org.aerogear.digger.client.model.BuildParameter;
public static final BuildParameter EXAMPLE = new BuildParameter(EXAMPLE)
.setDescription("Branch of project to checkout and build.")
.setDefaultValue("master");
private List<BuildParameter> params = Lists.newArrayList(EXAMPLE)
client.createJob("java-client-job1","https://github.com/wtrocki/helloworld-android-gradle","master", params);
Trigger a job:
BuildStatus buildStatus = client.build("java-client-job1");
Get build logs:
int buildNumber = 4;
String logs = client.getBuildLogs("java-client-job1", buildNumber);
Save artifacts to file
int buildNumber = 4;
String artifactName="*.apk"
File outputFile = ...
client.saveArtifact("java-client-job1", buildNumber,artifactName, outputFile);
Client works with Java6 and above.
mvn clean package