Introduction

James is a project that lives from the contributions of its community.
Anyone can contribute.
That's right, we always want to hear from people with contributions to the code, the documentation, the website, and bug reports.
The rest of this document outlines the way to go about these to maximum effect.

To keep you informed on James issues, subscribe to the relevant mailing lists

Be involved in the community

An easy start is to be involved in the community.
Share your experiences with James, your needs, your enhancements proposition via the mailing lists, on gitter, or on our Bug Tracker.
Don't hesitate to write articles and blog posts. Use your preferred media to spread the love!

Reporting Bugs

Many improvements come as a direct result of bug reports.
To report a bug, please use the appropriate Bug Tracker JIRA link according to the project you want to address:
Server
Mailet
Mailbox
Protocols
MPT
Mime4j
jSieve
jSPF
jDKIM
Hupa
Once you are logged on the appropriate JIRA page, click on the red Create button, then complete the different fields as accurately as possible, so that any user can reproduce the reported bug. Also note that all your information must be readable (use markedown).
Then, you have to click on Create to submit your bug.

Reporting security vulnerabilities

Security: Vulnerabilities should be announced to the Apache Security team.
PMCs will be notified about them, and will work hard to propose fixes as fast as possible.
Specific details about security in James can be found here.

Documentation

Documentation is an easy way to get on board! Check out the ~documentation label on JIRA to get some ideas.
Report on JIRA the typo you spots, the information you miss, and any improvement you can think to.
The next step is to contribute the documentation changes via Git.

To edit an existing document try to edit the xml version in src/site/xdoc (check it out from GIT) and if you can, submit a patch as for Code Patches.

If you want to contribute new files please try to use the markdown format as shown in src/site/markdown.

If this means nothing to you please try to contribute HTML or plain text documents without any styling, so that we can get at the words and easily convert them into the right format.

If all this seems like unnecessary nonsense, send us whatever you like, we'd still be happy to receive good documentation.

Each of the Apache James projects has its own documentation maintained with the automated build. Once a build is done, the documentation can be further committed in the site module which will be automatically published via gitpubsub to Apache James web site.

Further to this documentation, the Apache James wiki is available to any and is useful to share any useful documentation.

How to contribute to the code?

Clone the source code of the project from its apache git repository or its Github
Create your branch and name it with the JIRA ticket number.
Create a Pull Request with your branch name and prefix its different commits with the same name.

Alternatively you can create a patch as outlined below, and attach it to the JIRA ticket.

A valid commit comment might be:

JAMES-2285 My awesome commit title

Here is some more details about what my commit does, and the rationals of the choice I took.

Contribution proposals

We reference some easy tasks to start with : ~newbie
We have a collection of minor fixes awaiting contributions: ~easyfix
Challenge yourself with some cool features we thought to: ~feature
Additional ideas are more than welcome. Don't hesitate to discuss that with us!

Coding Standards

While we are glad to accept contributions to documentation from anyone, in almost any format, because its much better than none, please consider these guidelines to help us to assimilate your contribution.

Submissions to the James project must follow the coding conventions outlined in this document. James developers are asked to follow coding conventions already present in the code. (For example, if the existing code has the bracket on the same line as the if statement, then all subsequent code should also follow that convention.) Anything not explicitly mentioned in this document should adhere to the official Sun Java Coding Conventions .

Developers who commit code that does not follow the coding conventions outlined in this document will be responsible for fixing their own code.

1. Your code should pass our checkstyle which runs upon mvn clean install.

2. Extra spaces between parentheses are not allowed:

  
  if (foo) > Good
  
  or
  
  if ( foo ) > Bad
        

3. Four spaces.NO tabs. Period.
The James mailing list receives commit messages that are almost impossible to read if tabs are used.

In Emacs-speak, this translates to the following command: (setq-default tab-width 4 indent-tabs-mode nil)

4. Use Unix linefeeds for all .java source code files. Only platform-specific files (e.g. .bat files for Windows) should contain non-Unix linefeeds.

5. Javadoc MUST exist on all API methods. Contributing a missing javadoc for any method, class, variable, etc., will be GREATLY appreciated as this will help to improve the James project.

6. The standard Apache license header MUST be placed at the top of every file.

7. Your change set MUST be covered by tests. We also strongly appreciate integration tests.

8. pom.xml
We also require the following best practice regarding maven:

  • Define your dependency versions in james-project pom.xml. This structurally ensures all projects get the same version, and that there is no version clashes.
  • Don't use org.apache.james groupId for your dependencies. Use ${james.groupId}. If not, you break the policies for automatic sorting, as well as make it more ambiguous.
  • You should be ordering your dependencies. The sort order is:
        If the project is part of org.james.apache groupId? Internal dependencies goes first.
        Then we order by groupId
        Then we order by artifactId
        Then we order by type. test-jar goes last.
    Hopefully, some tools are doing this sorting for you:
          mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort -Dsort.keepBlankLines -Dsort.sortDependencies=groupId,artifactId -Dsort.nrOfIndentSpace=4 -Dsort.createBackupFile=false -Dsort.sortModules=true -Dsort.expandEmptyElements=false  -Dsort.predefinedSortOrder="recommended_2008_06"
        

You should also split multiple attributes each on a new line.

You should ensure your POM files, as well as sections ordering follows the Maven Model

Eclipse IDE
Eclipse users can import those two files to enfore the code formating : formatting.xml and codetemplates.xml .

Code Patches

Patches should be attached to the corresponding JIRA issue.
Always use diff -u to generate patches, so we can apply them using 'patch'.

Make sure the patch only contains what is intended, your checkout could be outdated.
Make sure it conforms to the code standards, otherwise it may be ignored. It is OK to make a single patch covering several files, but please only one issue at a time.
Briefly outline the reason for your patch, the solution your patch implements, why a patch is needed and why your code will solve the problem. Note any bug numbers your patch addresses.

The reason for these rules is so that committers can easily see what you are trying to achieve, it is their responsibility to manage the code and review submissions, if you make it easy for them to see what you are doing your patch is more likely to be committed quickly.