A Java client to communicate with a taskwarrior server (= taskd).
The current taskwarrior Android app does not satisfy my requirements. Therefore I created this client library to integrate it into my preferred task app. And I also want to share it with everybody who will love to use it.
- JDK 8
Currently there is no released version available but feel free to clone / fork and build it yourself. If you would love to see this on Maven Central feel free to create an issue.
For example using it with Java:
import java.io.IOException; import java.net.URL; import de.aaschmid.taskwarrior.TaskwarriorClient; import de.aaschmid.taskwarrior.config.TaskwarriorConfiguration; import de.aaschmid.taskwarrior.message.MessageType; import de.aaschmid.taskwarrior.message.TaskwarriorMessage; import de.aaschmid.taskwarrior.message.TaskwarriorRequestHeader; import static de.aaschmid.taskwarrior.config.TaskwarriorConfiguration.taskwarriorPropertiesConfiguration; import static de.aaschmid.taskwarrior.message.TaskwarriorMessage.taskwarriorMessage; import static de.aaschmid.taskwarrior.message.TaskwarriorRequestHeader.taskwarriorRequestHeaderBuilder; class Taskwarrior { private static final URL PROPERTIES_TASKWARRIOR = Taskwarrior.class.getResource("/taskwarrior.properties"); public static void main(String[] args) { if (PROPERTIES_TASKWARRIOR == null) { throw new IllegalStateException( "No 'taskwarrior.properties' found on Classpath. Create it by copy and rename 'taskwarrior.properties.template'. Also fill in proper values."); } TaskwarriorConfiguration config = taskwarriorPropertiesConfiguration(PROPERTIES_TASKWARRIOR); TaskwarriorRequestHeader header = taskwarriorRequestHeaderBuilder().authentication(config).type(MessageType.STATISTICS).build(); TaskwarriorMessage message = taskwarriorMessage(header.toMap()); TaskwarriorClient client = new TaskwarriorClient(config); TaskwarriorMessage response = client.sendAndReceive(message); System.out.println(response); } }
Used taskwarrior.properties can be created by copying and adjusting
src/main/resources/taskwarrior.properties.template.
To run tests manually you will need to build and run taskwarrior server container. See here how.
| Key specification | PEM format¹ | DER format |
|---|---|---|
| PKCS#1 | yes | |
| PKCS#8 | yes | yes |
¹: The kind of format is currently detected by file extentions.
Note: Keys can be transformed using openssl, e.g. from PKCS#8 in PEM format to PKCS#1 in DER format:
openssl pkcs8 -topk8 -nocrypt -in $TASKD_GENERATED_KEY.key.pem -inform PEM -out $KEY_NAME.key.pkcs8.der -outform DER
Releases and Release Notes are available here.