Languages
Java
The Java SDK publishes to Maven Central.
Install
xml
<dependency>
<groupId>com.your-org</groupId>
<artifactId>api-client</artifactId>
<version>1.0.0</version>
</dependency>Options
| Option | Values | Default |
|---|---|---|
| Client style | functions, namespaced, class, class-namespaced | functions |
| Argument style | object, positional | object |
| Namespace | tags, path | tags |
| Doc comments | full, minimal | full |
| File header | omit, include | omit |
| Usage example | full, concise | full |
No HTTP engine choice for Java
Kotlin offers okhttp or ktor; Java does not expose the choice.
class suits Java better than functions
functions maps awkwardly onto a language with no free functions. Set Client style to class or class-namespaced for Java specifically, and leave other languages on the project default.
Package name
Maven coordinates are groupId:artifactId, and the groupId must be a domain you control:
text
com.acme:api-clientMaven Central verifies the groupId
Central requires proof you own the domain behind the groupId, and releases are signed. That's more setup than npm, and it's worth starting before the day you want to ship.
Central releases are immutable
A published version can never be changed or removed. See Publishing.
What callers write
java
import com.acme.AcmeClient;
import com.acme.models.User;
AcmeClient client = AcmeClient.builder()
.token(System.getenv("ACME_TOKEN"))
.build();
for (User user : client.users().list(100)) {
System.out.println(user.getId());
}