https://github.com/perforce/p4java
[Officially Supported] P4Java a native API for Perforce SCM
https://github.com/perforce/p4java
Last synced: 6 days ago
JSON representation
[Officially Supported] P4Java a native API for Perforce SCM
- Host: GitHub
- URL: https://github.com/perforce/p4java
- Owner: perforce
- License: other
- Created: 2020-09-08T10:48:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-14T15:34:11.000Z (about 2 years ago)
- Last Synced: 2024-02-14T16:38:04.998Z (about 2 years ago)
- Language: Java
- Homepage:
- Size: 1.07 MB
- Stars: 1
- Watchers: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](mailto:support@perforce.com)
# P4Java
P4Java is officially supported by Perforce. Pull requests will be managed by Perforce's engineering teams. We will do our best to acknowledge these in a timely manner based on available capacity. Issues will not be managed on GitHub. All issues should be recorded via Perforce's standard support process (https://www.perforce.com/support/request-support).
## Overview
P4Java is a Java-native API for accessing Perforce SCM services from within Java applications, servlets, plugins, and other Java contexts.
## Requirements
* Perforce server at Release 2015.1 or higher.
* Java: full standard JDK 1.8 or later. Implementation as discussed in "Known Limitations" below.
* SSL: unlimited strength JCE (Java Cryptography Extension) package for 256-bit encryption level SSL connection to a secure Perforce server.
### SSL and Trust
Perforce server 2015.1 or higher supports 256-bit SSL connections and trust establishment via accepting the fingerprint of the SSL certificate's public key. The standard JDK comes with 128-bit encryption level ciphers. In order to use P4Java to connect to a secure Perforce server, you must download and install the unlimited strength JCE package for your JDK version.
To make a secure connection using P4Java, simply append 'ssl' to the end of the P4Java protocol (i.e. 'p4javassl://perforce:1667'). For new a connection or a key change, you must also (re)establish trust using the IOptionsServer's 'addTrust' method. See example code snippet below:
// Create a P4Java SSL connection to a secure Perforce server
try {
String serverUri = "p4javassl://perforce:1667";
Properties props = null;
IOptionsServer server = ServerFactory.getOptionsServer(serverUri, props);
// assume a new first time connection
// you should also handle a key change situation...
server.addTrust(new TrustOptions().setAutoAccept(true));
// if all goes well...
IServerInfo serverInfo = server.getServerInfo();
} catch (P4JavaException e) {
// process P4Java exception
} catch (Exception e) {
// process other exception
}
P4Java 2020.1 has changed the default TLS support to TLSv1.2 for use with Perforce server 2019.1 or greater this can be modified using the JVM option:
java -DsecureSocketEnabledProtocols=TLSv1.2
## Documentation
For more information please refer to the Helix Core P4Java Developer Guide https://www.perforce.com/manuals/p4java/Content/P4Java/Home-p4java.html
## Support
This project is maintained by Perforce Engineering and fully supported. Pull requests will be managed by Perforce's engineering teams. We will do our best to acknowledge these in a timely manner based on available capacity. Issues will not be managed on GitHub. All issues should be recorded via Perforce's standard support process (https://www.perforce.com/support/request-support).
## Usage
The example snippets in this project require P4Java (2019.1 or later) available from Maven Central (`https://repo1.maven.org/maven2/`). Use one of the following tools to add the dependancy.
### Maven
com.perforce
p4java
2019.1.1939255
### Gradle
compile group: 'com.perforce', name: 'p4java', version: '2019.1.1939255'