Skip to content
Trustin Lee edited this page Feb 4, 2014 · 40 revisions
Looking for a tutorial? Visit the documentation home. Got a question? Ask at StackOverflow.com.
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.

Working with the source code

Important!

Before pushing your commits or issuing a pull request, make sure:

  • your work builds without any failure - run 'mvn test' from shell.
  • your work does not introduce any new inspection warning - see below.

Setting 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.

Code style

Unfortunately, IntelliJ IDEA doesn't provide a way to import a code style via the configuration dialog. Download this code style configuration and unzip Netty project.xml into <IntelliJ config directory>/codestyles directory. Choose 'Netty project' as the default code style.

Inspection profile

Download, unzip, and import this inspection profile into your IntelliJ IDEA and use it as the default. See here to learn how to import an inspection profile.

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 profile

Copyright text:

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

Setting up Eclipse with M2E and Java 7

Netty project can be imported into Eclipse 3.7 or later with M2E integration out of the box.

Netty project Maven pom.xml settings dictate use of Java SE 1.6, while implicitly using Java 7 (1.7) features if present. This may result in compilation errors in Eclipse.

One way to deal with this - look in Eclipse -> Window -> Preferences -> Installed JRE

  • make sure you have Java 7 installation available under Installed JRE
  • map this Java 7 installation onto Java 6 : Installed JRE -> Execution Environments -> Java SE 1.6

Alternatively, Java 7 JRE can be selected on per-project basis for each Netty module.

Git line ending configuration

We use native line ending for all source code (i.e. '\n' for *nix and MacOS X, '\r\n' for Windows.) Please configure your Git installation so that your build does not fail and you push bad files, following the instructions below:

Merging a pull request

A pull request often contains multiple comments. Those commits must be squashed into smaller number of commits with explanatory comments.

Do not merge a pull request via the web UI unless there's a good reason doing that. Refer to the 'Patch and Apply' section in the Github help page.

Writing a new post

Our web site is generated from an Awestruct project here. To post a new article, create a new branch, write a new post, and issue a pull request like usual contributions.

Design ideas