Warning
The Oras Java SDK is currently in alpha state.
It's configuration and APIs might change in future releases
OCI Registry as Storage enables libraries to push OCI Artifacts to OCI Conformant registries. This is a Java SDK for Java developers to empower them to do this in their applications.
SNAPSHOT version are published on GitHub Maven package.
GitHub requires authentication to download packages. You can use a personal access token to authenticate with GitHub Packages. To authenticate with GitHub Packages, you need to update your ~/.m2/settings.xml
file to include your personal access token.
<server>
<id>oras-java</id>
<username>YOUR_USERNAME</username>
<password>YOUR_ACCESS_TOKEN_WITH_PACKAGE_READ_SCOPE</password>
</server>
Then on your pom.xml
<repositories>
<repository>
<id>oras-java</id>
<url>https://maven.pkg.github.com/oras-project/oras-java</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Path artifact = Path.of("pom.xml");
Registry registry = Registry.Builder.builder()
.withInsecure(true)
.build();
Manifest manifest = registry.pushArtifact(ContainerRef.parse("localhost:5000/hello:v1"), artifact);
registry.pullArtifact(ContainerRef.parse("localhost:5000/hello:v1"), Path.of("folder"));
This is temporary until published to Maven Central with a proper workflow.
The maven resolver must be switched to wagon
to deploy to GitHub Packages.
mvn -Dmaven.resolver.transport=wagon -DskipTests -Poras-java clean deploy
Please note that this project has adopted the CNCF Code of Conduct. Please follow it in all your interactions with the project members and users.
This code is licensed under the Apache 2.0 LICENSE.