This project implements a purl parser and class for Java.
- The library has a runtime requirement of JRE 8 or newer.
- To build the library from source, you need JDK 17 or newer.
mvn clean installPackage URL is available on the Maven Central Repository. These can be used without having to compile the project yourself.
<dependencies>
<dependency>
<groupId>com.github.package-url</groupId>
<artifactId>packageurl-java</artifactId>
<version>1.5.0</version>
</dependency>
</dependencies>Creates a new PackageURL object from a purl string:
PackageURLpurl = newPackageURL(purlString);Creates a new PackageURL object from parameters:
PackageURLpurl = newPackageURL(type, namespace, name, version, qualifiers, subpath);Creates a new PackageURL object using the builder pattern:
PackageURLpurl = PackageURLBuilder.aPackageURL()
.withType("type")
.withNamespace("namespace")
.withName("name")
.withVersion("version")
.withQualifier("key","value")
.withSubpath("subpath")
.build();Validates a String field in a POJO (Bean Validation):
@PackageURLprivateStringpurl;Permission to modify and redistribute is granted under the terms of the MIT License