Setting up development environment
Please note that this guide is not a 'user guide'. It is not intended for the 'users' who build an application using Netty but for the contributors ('dev') who want to develop Netty itself.
Use 64-bit operating system
You must use 64-bit operating system.
Install the necessary build tools
You must have 64-bit OpenJDK 8 or above from a vendor like AdoptOpenJDK or Azul Systems, Apache Maven 3.1.1 or above, and Git installed on your machine. If you are on Linux, you have to install the following packages:
# yum install lsb-core autoconf automake libtool make tar \ glibc-devel libaio-devel openssl-devel apr-devel \ lksctp-tools # apt-get install autoconf automake libtool make tar \ libaio-dev libssl-dev libapr1-dev \ lksctp-tools
To build netty-tcnative (namely it's BoringSSL part), install also
golang packages. The
golang on Fedora/CentOS are available in the Fedora EPEL repository.
Set up IntelliJ IDEA
Netty project team uses IntelliJ IDEA as the primary IDE, although we are fine with using other development environments as long as you adhere to our coding style.
Use the same-bit version with your OS
If you are on 64-bit operating system, use the 64-bit version of IntelliJ IDEA. For instance, the start menu shortcut points to the 32-bit binary even if you are using 64-bit Windows. You'll have to find the
idea64.exe in the installation directory and use it instead. Otherwise, you'll see IntelliJ IDEA complains that it cannot find
Download this code style configuration and unzip
Netty project.xml into
<IntelliJ config directory>/codestyles directory. Choose 'Netty project' as the default code style.
Ensure your modification does not introduce any inspection warning. If you think it's a false positive, suppress the warning by using the
@SuppressWarnings annotation or
noinspection line comment as guided by the IDE. For more information about using the inspector, please refer to the web help pages.
Copyright $today.year The Netty Project The Netty Project licenses this file to you under the Apache License, version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Keyword to detect copyright in comments:
The Netty project licenses
Allow replacing copyright if old copyright contains:
The Netty project licenses
Set up Eclipse with M2E and Java 7/8
- Ensure you are using the 64-bit version of Eclipse.
Download os-maven-plugin and put it into
<ECLIPSE_INSTALLATION_DIR>/plugins(Eclipse 4.5) or
<ECLIPSE_INSTALLATION_DIR>/dropins(Eclipse 4.6) directory to work around the problem where m2e does not evaluate an extension specified in our
pom.xml. (Unlike its name, it's both a Maven plugin and an Eclipse plugin.)
- Import the project via the 'File → Import... → Existing Maven Projects' menu.
- Netty project Maven
pom.xmlsettings dictate the use of Java SE 1.6, while implicitly using Java 7/8 (1.7/1.8) features if present. This may result in compilation errors in Eclipse. There are two ways to work around this problem:
- Look in the 'Window → Preferences → Installed JRE' menu: * Make sure you have Java 7/8 installation available under 'Installed JRE' * Map this Java 7/8 installation onto Java 6: 'Installed JRE → Execution Environments → Java SE 1.6'
- Alternatively, Java 7/8 JRE can be selected on per-project basis for each Netty module.