blob: 78e6445a6daa49745604707e6d0432c5585a0d12 [file] [log] [blame] [view]
Mark Slee54b7ab92007-03-06 00:06:27 +00001Thrift Java Software Library
2
Bryan Duxburydef30a62009-04-08 00:19:37 +00003License
4=======
5
6Licensed to the Apache Software Foundation (ASF) under one
7or more contributor license agreements. See the NOTICE file
8distributed with this work for additional information
9regarding copyright ownership. The ASF licenses this file
10to you under the Apache License, Version 2.0 (the
11"License"); you may not use this file except in compliance
12with the License. You may obtain a copy of the License at
13
14 http://www.apache.org/licenses/LICENSE-2.0
15
16Unless required by applicable law or agreed to in writing,
17software distributed under the License is distributed on an
18"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19KIND, either express or implied. See the License for the
20specific language governing permissions and limitations
21under the License.
Mark Slee54b7ab92007-03-06 00:06:27 +000022
Alex Volanis7004a612018-01-24 10:30:13 -050023Building and installing from source
24===================================
25
26When using a CMake build from the source distribution on Linux the
27easiest way to build and install is this simple command line:
28
29 make all && sudo make install/fast
30
31It is important to use the install/fast option to eliminate
32the automatic rebuild by dependency that causes issues because
33the build tooling is designed to work with cached files in the
34user home directory during the build process. Instead this builds
35the code in the expected local build tree and then uses CMake
36install code to copy to the target destination.
37
38Building Thrift with Gradle without CMake/Autoconf
39==================================================
Mark Slee54b7ab92007-03-06 00:06:27 +000040
41The Thrift Java source is not build using the GNU tools, but rather uses
Alex Volanis7004a612018-01-24 10:30:13 -050042the Gradle build system, which tends to be predominant amongst Java
Mark Slee54b7ab92007-03-06 00:06:27 +000043developers.
44
45To compile the Java Thrift libraries, simply do the following:
46
Alex Volanis7004a612018-01-24 10:30:13 -050047 ./gradlew
Mark Slee54b7ab92007-03-06 00:06:27 +000048
Alex Volanis7004a612018-01-24 10:30:13 -050049Yep, that's easy. Look for libthrift-<version>.jar in the build/libs directory.
50
51The default build will run the unit tests which expect a usable
52Thrift compiler to exist on the system. You have two choices for
53that.
54
55* Build the Thrift executable from source at the default
56 location in the source tree. The project is configured
57 to look for it there.
58* Install the published binary distribution to have Thrift
59 executable in a known location and add the path to the
60 ~/.gradle/gradle.properties file using the property name
61 "thrift.compiler". For example this would set the path in
62 a Windows box if Thrift was installed under C:\Thrift
63
64 thrift.compiler=C:/Thrift/thrift.exe
65
66To just build the library without running unit tests you simply do this.
67
68 ./gradlew assemble
69
70To install the library in the local Maven repository location
71where other Maven or Gradle builds can reference it simply do this.
72
73 ./gradlew install
74
75The library will be placed in your home directory under .m2/repository
Mark Slee54b7ab92007-03-06 00:06:27 +000076
77To include Thrift in your applications simply add libthrift.jar to your
78classpath, or install if in your default system classpath of choice.
79
Roger Meier6823b6d2012-01-24 19:35:09 +000080
81Build Thrift behind a proxy:
82
Alex Volanis7004a612018-01-24 10:30:13 -050083 ./gradlew -Dhttp.proxyHost=myproxyhost -Dhttp.proxyPort=8080 -Dhttp.proxyUser=thriftuser -Dhttp.proxyPassword=topsecret
Roger Meier6823b6d2012-01-24 19:35:09 +000084
85or via
86
Alex Volanis7004a612018-01-24 10:30:13 -050087 ./configure --with-java GRADLE_OPTS='-Dhttp.proxyHost=myproxyhost -Dhttp.proxyPort=8080 -Dhttp.proxyUser=thriftuser -Dhttp.proxyPassword=topsecret'
88
89
90Unit Test HTML Reports
91======================
92
93The build will automatically generate an HTML Unit Test report. This can be found
94under build/reports/tests/test/index.html. It can be viewed with a browser
95directly from that location.
96
97
98Clover Code Coverage for Thrift
99===============================
100
101The build will optionally generate Clover Code coverage if the Gradle property
102`cloverEnabled=true` is set in ~/.gradle/gradle.properties or on the command line
103via `-PcloverEnabled=true`. The generated report can be found under the location
104build/reports/clover/html/index.html. It can be viewed with a browser
105directly from that location. Additionally, a PDF report is generated and is found
106under the location build/reports/clover/clover.pdf.
107
108The following command will build, unit test, and generate Clover reports:
109
110 ./gradlew -PcloverEnabled=true
111
112
113Publishing Maven Artifacts to Maven Central
114===========================================
115
116The Automake build generates a Makefile that provides the correct parameters
117when you run the build provided the configure.ac has been set with the correct
118version number. The Gradle build will receive the correct value for the build.
119The same applies to the CMake build, the value from the configure.ac file will
120be used if you execute these commands:
121
122 make maven-publish -- This is for an Automake Linux build
123 make MavenPublish -- This is for a CMake generated build
124
125The uploadArchives task in Gradle is preconfigured with all necessary details
126to sign and publish the artifacts from the build to the Apache Maven staging
127repository. The task requires the following externally provided properties to
128authenticate to the repository and sign the artifacts. The preferred approach
129is to create or edit the ~/.gradle/gradle.properties file and add the following
130properties to it.
131
132 # Signing key information for artifacts PGP signature (values are examples)
133 signing.keyId=24875D73
134 signing.password=secret
135 signing.secretKeyRingFile=/Users/me/.gnupg/secring.gpg
136
137 # Apache Maven staging repository user credentials
138 mavenUser=meMyselfAndI
139 mavenPassword=MySuperAwesomeSecretPassword
140
James E. King III98f379e2019-01-22 09:22:04 -0500141NOTE: If you do not have a secring.gpg file, see the
142[gradle signing docs](https://docs.gradle.org/current/userguide/signing_plugin.html)
143for instructions on how to generate it.
144
Alex Volanis7004a612018-01-24 10:30:13 -0500145It is also possible to manually publish using the Gradle build directly.
146With the key information and credentials in place the following will generate
147if needed the build artifacts and proceed to publish the results.
148
James E. King III98f379e2019-01-22 09:22:04 -0500149 ./gradlew -Prelease=true uploadArchives
Alex Volanis7004a612018-01-24 10:30:13 -0500150
151It is also possible to override the target repository for the Maven Publication
152by using a Gradle property, for example you can publish signed JAR files to your
153company internal server if you add this to the command line or in the
154~/.gradle/gradle.properties file. The URL below assumes a Nexus Repository.
155
156 maven-repository-url=https://my.company.com/service/local/staging/deploy/maven2
157
158Or the same on the command line:
159
160 ./gradlew -Pmaven-repository-url=https://my.company.com/service/local/staging/deploy/maven2 -Prelease=true -Pthrift.version=0.11.0 uploadArchives
Roger Meier6823b6d2012-01-24 19:35:09 +0000161
162
Mark Slee54b7ab92007-03-06 00:06:27 +0000163Dependencies
164============
165
Alex Volanis7004a612018-01-24 10:30:13 -0500166Gradle
167http://gradle.org/
Beluga Behr9e813ae2018-12-31 10:58:19 -0500168
169# Breaking Changes
170
Beluga Behre20ab3e2019-01-06 15:08:58 -0500171## 1.0
172
Mithun RKc35ed732019-03-11 14:14:05 -0700173* The signature of the 'process' method in TAsyncProcessor and TProcessor has
Beluga Behre20ab3e2019-01-06 15:08:58 -0500174changed to remove a boolean return type and to instead rely on Exceptions.
175
Mithun RKc35ed732019-03-11 14:14:05 -0700176* Per THRIFT-4805, TSaslTransportException has been removed. The same condition
177is now covered by TTansportException, where `TTransportException.getType() == END_OF_FILE`.
178
Beluga Behr9e813ae2018-12-31 10:58:19 -0500179## 0.12.0
180
181The access modifier of the AutoExpandingBuffer class has been changed from
182public to default (package) and will no longer be accessible by third-party
183libraries.
184
Beluga Behr88584f82019-01-01 16:35:04 -0500185The access modifier of the ShortStack class has been changed from
186public to default (package) and will no longer be accessible by third-party
187libraries.
188