This Java library allows parsing Git repository URL addresses to an actual object with validation included.
Yes, most Git repository URL can be parse URL or URI without issue. However, alternative form of SSH URL not.
Alternative SSH address is reference as "SSH" in public git repository which supposed to be invalid technically since it missed protocol and not a port number after the colon. Thus, inheriting URL or URI is disallowed since they are marked as final class. As a result, create new object which replicate how original URL or URI did with incompatable format supported.
Most remote protocol are supported in this library.
Protocol format name | Example | Supported in this library |
---|---|---|
HTTPS protocol | https://example.com/foo.git |
✅ |
Git protocol | git://example.com/foo.git |
✅ |
SSH protocol (Legit) | ssh://git@example.com/foo.git |
✅ |
SSH protocol (Alternative) | git@example.com:foo.git |
✅ |
File protocol | file:///path/to/foo.git |
❌ |
Jogu does not support file protocol since it rarely uses and worthless when making actual request under local directory.
Using Maven 3:
<dependencies>
<dependency>
<groupId>xyz.rk0cc.jogu</groupId>
<artifactId>jogu</artifactId>
<version>1.1.2</version>
</dependency>
</dependencies>
Get GitRepositoryURL
without specific implemented type uses:
GitRepositoryURL gurl = GitRepositoryURL.parse("git://example.com/foo.git");
Get GitRepositoryURL
with specific implemented type uses:
GitGitRepositoryURL gurl = GitRepositoryURL.parse("git://example.com/foo.git", GitGitRepositoryURL.class);
- JDK 17 (or above)
- Maven
WTFPL 2.0