blob: 0cd7ebd047a346950c872b330b596f99c712d2ea [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF 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.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Generated by Apache Maven Doxia at 2021-11-12 -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apache James Project &#x2013; Apache James Server 3 - Build Apache James from Source</title>
<style type="text/css" media="all">
@import url("../css/james.css");
@import url("../css/maven-base.css");
@import url("../css/maven-theme.css");
@import url("../css/site.css");
@import url("../js/jquery/css/custom-theme/jquery-ui-1.8.5.custom.css");
@import url("../js/jquery/css/print.css");
@import url("../js/fancybox/jquery.fancybox-1.3.4.css");
</style>
<script type="text/javascript" src="../js/jquery/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/jquery/js/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="../js/fancybox/jquery.fancybox-1.3.4.js"></script>
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
<meta name="Date-Revision-yyyymmdd" content="20211112" />
<meta http-equiv="Content-Language" content="en" />
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1384591-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script').item(0); s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="composite">
<div id="banner">
<a href="../index.html" id="bannerLeft" title="james-logo.png">
<img src="../images/logos/james-logo.png" alt="James Project" />
</a>
<a href="https://www.apache.org/index.html" id="bannerRight">
<img src="images/logos/asf_logo_small.png" alt="The Apache Software Foundation" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 2021-11-12</span>
</div>
<div class="xright"> <a href="../index.html" title="Home">Home</a>
|
<a href="../documentation.html" title="James">James</a>
|
<a href="../mime4j/index.html" title="Mime4J">Mime4J</a>
|
<a href="../jsieve/index.html" title="jSieve">jSieve</a>
|
<a href="../jspf/index.html" title="jSPF">jSPF</a>
|
<a href="../jdkim/index.html" title="jDKIM">jDKIM</a>
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>James components</h5>
<ul>
<li class="collapsed">
<a href="../documentation.html" title="About James">About James</a>
</li>
<li class="expanded">
<a href="../server/index.html" title="Server">Server</a>
<ul>
<li class="none">
<a href="../server/advantages.html" title="Advantages">Advantages</a>
</li>
<li class="none">
<a href="../server/objectives.html" title="Objectives">Objectives</a>
</li>
<li class="expanded">
<a href="../server/quick-start.html" title="User Manual">User Manual</a>
<ul>
<li class="collapsed">
<a href="../server/features.html" title="1. Features">1. Features</a>
</li>
<li class="none">
<a href="../server/packaging.html" title="2. Packaging">2. Packaging</a>
</li>
<li class="collapsed">
<a href="../server/install.html" title="3. Install James">3. Install James</a>
</li>
<li class="collapsed">
<a href="../server/config.html" title="4. Configure James">4. Configure James</a>
</li>
<li class="collapsed">
<a href="../server/manage.html" title="5. Manage">5. Manage</a>
</li>
<li class="collapsed">
<a href="../server/monitor.html" title="6. Monitor">6. Monitor</a>
</li>
<li class="collapsed">
<a href="../server/upgrade.html" title="7. Upgrade">7. Upgrade</a>
</li>
<li class="expanded">
<a href="../server/dev.html" title="8. Developers Corner">8. Developers Corner</a>
<ul>
<li class="none">
<strong>Build from source</strong>
</li>
<li class="none">
<a href="../server/dev-database-schema.html" title="Database Schema">Database Schema</a>
</li>
<li class="collapsed">
<a href="../server/dev-extend.html" title="Develop Extensions">Develop Extensions</a>
</li>
<li class="collapsed">
<a href="../server/dev-provided.html" title="Provided Extensions">Provided Extensions</a>
</li>
</ul>
</li>
</ul>
</li>
<li class="none">
<a href="../mail.html#James_Mailing_lists" title="Mailing Lists">Mailing Lists</a>
</li>
<li class="none">
<a href="../server/release-notes.html" title="Release Notes">Release Notes</a>
</li>
<li class="none">
<a href="../server/apidocs/index.html" title="Javadoc">Javadoc</a>
</li>
<li class="none">
<a href="https://issues.apache.org/jira/browse/JAMES" title="Issue Tracker">Issue Tracker</a>
</li>
<li class="none">
<a href="https://github.com/apache/james-project" title="Sources">Sources</a>
</li>
<li class="none">
<a href="../server/rfcs.html" title="RFCs">RFCs</a>
</li>
<li class="none">
<a href="../download.cgi#Apache_James_Server" title="Download releases">Download releases</a>
</li>
</ul>
</li>
<li class="collapsed">
<a href="../mailet/index.html" title="Mailets">Mailets</a>
</li>
<li class="collapsed">
<a href="../mailbox/index.html" title="Mailbox">Mailbox</a>
</li>
<li class="collapsed">
<a href="../protocols/index.html" title="Protocols">Protocols</a>
</li>
<li class="collapsed">
<a href="../mpt/index.html" title="MPT">MPT</a>
</li>
</ul>
<h5>Apache Software Foundation</h5>
<ul>
<li>
<strong>
<a title="ASF" href="http://www.apache.org/">ASF</a>
</strong>
</li>
<li>
<a title="Get Involved" href="http://www.apache.org/foundation/getinvolved.html">Get Involved</a>
</li>
<li>
<a title="FAQ" href="http://www.apache.org/foundation/faq.html">FAQ</a>
</li>
<li>
<a title="License" href="http://www.apache.org/licenses/" >License</a>
</li>
<li>
<a title="Sponsorship" href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a>
</li>
<li>
<a title="Thanks" href="http://www.apache.org/foundation/thanks.html">Thanks</a>
</li>
<li>
<a title="Security" href="http://www.apache.org/security/">Security</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="../images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<section>
<h2><a name="Why_Build_from_Source.3F"></a>Why Build from Source?</h2>
<p>This step is not necessary to use the standard out of the box version of James. A
pre-built binary version of James is available from the James download directory.</p>
<p>But if you wish to customize the James source code, it will be necessary for you to
build the distribution yourself.</p>
<p>You can read on this page how to build from the command line and from eclipse IDE.</p>
</section>
<section>
<h2><a name="Get_Source_Code"></a>Get Source Code</h2>
<p>There are two ways to get the James source code.</p>
<ol style="list-style-type: decimal">
<li>Download the source distribution - the source is available from the
<a class="externalLink" href="https://james.apache.org/download.cgi">James release mirrors</a>.
Simply choose the version of James you'd like to download, and pick the source
distribution appropriate for your platform.</li>
<li>Get the source code using GIT - this method gives you access to the cutting edge code
base. Instructions on how to use GIT to get the James source code
can be found <a class="externalLink" href="https://www.apache.org/dev/git.html">here</a>.
Apache James Server repository is <a class="externalLink" href="http://git-wip-us.apache.org/repos/asf/james-project.git">http://git-wip-us.apache.org/repos/asf/james-project.git</a>.</li>
<li>For information, you can download all Apache James sources (server, mailbox, imap, mailet...) if you check out <a class="externalLink" href="http://git-wip-us.apache.org/repos/asf/james-project.git">http://git-wip-us.apache.org/repos/asf/james-project.git</a>.
Watch out!: you will get a release, but what we call a &quot;master&quot;, that is on constant development and debugging.</li>
</ol>
<p>We consider in this document that you have checked-out James source code in JAMES_SRC_HOME directory.</p>
<p>Consult the <a href="dev.html">architecture</a> page if you want to learn
more on the internal source structure.</p>
</section>
<section>
<h2><a name="Required_Tools"></a>Required Tools</h2>
<p>To run the build you need two third-party tools.</p>
<ol style="list-style-type: decimal">
<li>Java Development Kit - You must have a JDK of Java version 11 or higher installed to build the
James distribution. The exact JDKs available depend on the platform. A JDK must be downloaded and
installed before the build can run.</li>
<li>Maven 3.6.0 - This is a Java-tailored, XML-configured, extensible build or make system. You need maven (3.6.0+) in order
to build James. We recommend you to use maven 3.6.2. You can get maven from <a class="externalLink" href="http://maven.apache.org/download.html">here</a>.
Installation instructions for maven are also available on the same page <a class="externalLink" href="http://maven.apache.org/download.html">http://maven.apache.org/download.html</a>.</li>
</ol>
<p>Set (on windows) or export (on Unix) MAVEN_OPTS to tune the memory needed by maven with &quot;MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=128m&quot;</p>
</section>
<section>
<h2><a name="Build_James_Source_from_Command_Line"></a>Build James Source from Command Line</h2>
<p>In the JAMES_SRC_HOME top level directory (where the parent pom.xml resides), invoke maven with 'mvn' with any of the following command line arguments:
</p>
<ul>
<li>clean - deletes the target directory, making the system ready for a clean build.</li>
<li>compile - compiles the source code.</li>
<li>test - run unit tests for James.</li>
<li><b>package - generates all the James distributions, packed.
From the root directory, cd to 'server/app/target' to have the build distribution.</b></li>
<li>javadocs:javadocs - builds the James javadocs.</li>
<li>site - builds the entirety of the James website.</li>
</ul>
<p>For example, invoke mvn package to get a zip/tar of James distribution.</p>
<p>Spring product is output in the server/apps/spring/target
subdirectory of the James source directory.
This directory will be deleted if you run build with the clean argument.</p>
<p><b>Warning!</b> Any changes you've made in the 'dist' directory
will be lost after a recompilation. You should not run James from this directory.</p>
<p>You can also invoke the command line from a shell. Go to the server project cli folder and type mvn exec:java -Dexec.args=&quot;-h localhost -p 9999 help&quot;</p>
</section>
<section>
<h2><a name="Build_James_from_IntelliJ_IDEA"></a>Build James from IntelliJ IDEA</h2>
<p>This section has been created using IntelliJ IDEA 2019.2.1 and Maven 3. And downloading the master version of the server
from http://git-wip-us.apache.org/repos/asf/james-project.git/.
</p>
<section>
<h3><a name="Getting_the_sources_from_the_repository"></a>Getting the sources from the repository</h3>
<p>To download the source code, you can use the Git support that comes with IntelliJ IDEA following the next steps:</p>
<p>First, in the Welcome page, click on <b>Check out from Version Control</b> and select <b>Git</b>.</p>
<img src="./images/intellij-idea/intellij-new-project.png" alt="" />
<p>In the pop-up window, fill the <b>URL</b> part to <i>http://git-wip-us.apache.org/repos/asf/james-project.git</i>.</p>
<img src="./images/intellij-idea/intellij-git-repo.png" alt="" /> <br />
<p>When this process is done, the project should look like this. <br /></p>
<img src="./images/intellij-idea/intellij-james-project.png" alt="" />
</section>
<section>
<h3><a name="Building_the_project"></a>Building the project</h3>
<p> To build the project, you must open the <b>Maven Projects</b> panel (should be the maven option in the upper right). Then double click on the package goal to run this goal.<br /></p>
<img src="./images/intellij-idea/intellij-mvn.png" alt="" />
<p>Then you will find the James server zip in the <b>server/app/target</b> folder.<br /></p>
<img src="./images/intellij-idea/intellij-james-zip.png" alt="" />
<p>Note that tests can be long and can be skept by toggling <i>skip test</i></p>
</section>
</section>
<section>
<h2><a name="Build_James_Source_from_Eclipse"></a>Build James Source from Eclipse</h2>
<p>Warning: due to bad scala support in eclipse, we are not able to compile James with Eclipse. Contributions to
enhance the current situation are more than welcome.</p>
<p>Upon the following documentation, an interesting resource
<a class="externalLink" href="http://blog.bonnydoonmedia.com/post.cfm/walkthrough-tutorials-compiling-apache-james-v3-with-eclipse">
can be found here</a>
</p>
<section>
<h3><a name="Import_projects_in_Eclipse_with_m2eclipse"></a>Import projects in Eclipse with m2eclipse</h3>
<p>You should have Eclipse IDE with <a class="externalLink" href="http://m2eclipse.sonatype.org">m2eclipse</a> plugin installed.</p>
<p>You now need to import the maven projects in the Eclipse workspace.</p>
<p>Therefore, click on the File menu and select Import.
Choose Existing Maven Project and click on Next button.</p>
<img src="./images/eclipse/eclipse-import-maven-view-1.gif" alt="" />
</section>
<section>
<h3><a name="Select_Projects_to_Import"></a>Select Projects to Import</h3>
<p>Select the JAMES_SRC_HOME directory where you have checked out the source code.</p>
<p>Eclipse should present you with the list of James server modules.</p>
<p>Select the modules you want to import (by default, all) and click on Finish
to execute the import.</p>
<img src="./images/eclipse/eclipse-import-maven-view-2.gif" alt="" />
</section>
<section>
<h3><a name="Enable_Workspace_Resolution"></a>Enable Workspace Resolution</h3>
<p>Check that 'Workspace resolution' is enable in m2eclipse plugin.</p>
<p>Your changes in code will be directly taken into account.</p>
<img src="./images/eclipse/eclipse-m2eclipse-project-dependencies.gif" alt="" />
</section>
<section>
<h3><a name="Prepare_projects"></a>Prepare projects</h3>
<p>Now you have James projects in Eclipse workspace.</p>
<p>You still have to prepare the following to be able to run from Eclipse:</p>
<ol style="list-style-type: decimal">
<li>Copy the context folder, log4j.properties
and META-INF folder from server/container/spring/src/main/config/james
directory to a source folder of james-server-spring project (you can use for example a
new folder called stage as Eclipse source folder).</li>
<li>Copy all files (except context folder log4j.properties and META-INF/persistence.xml)
from server/container/src/main/config/james folder to a conf folder
(conf folder must be a sub-folder of the JAMES_SRC_HOME directory where you made the check-out).
As non-root privilege user, you may need to change the SMTP/IMAP/POP3 ports to values higher than 1024.</li>
<li>For ease, you can also create 2 new eclipse projects to edit the files and visualize the created mails/store/...:
james-server-container-spring-conf and james-server-container-spring-var.</li>
</ol>
<img src="./images/eclipse/eclipse-m2eclipse-projects.gif" alt="" />
</section>
<section>
<h3><a name="Run_James_from_Eclipse"></a>Run James from Eclipse</h3>
<p>That's it. Run or Debug James in Eclipse (right-click on the Main class) and Have Fun!.</p>
<img src="./images/eclipse/eclipse-run-james.gif" alt="" />
<p>If you change a JPA Entity class, your will need to run 'mvn package'
or add the following option to the VM argument of your run configuration
'-javaagent:my_home_folder/.m2/repository/org/apache/openjpa/openjpa/3.1.0/openjpa-3.1.0.jar'
</p>
</section>
</section>
<section>
<h2><a name="Build_James_from_NetBeans"></a>Build James from NetBeans</h2>
<p>This was done using NetBeans 7, which comes bundled with Maven 3, needed to build James 3.
Older versions of NetBeans should be able to build James fine, provided that you configure them to use an instance of Maven 3, if they do not have it.
I used james 3.0-beta1 release and it builds in 7:40 min on my notebook running Debian Squeeze.
</p>
<section>
<h3><a name="Getting_the_sources_from_the_repository"></a>Getting the sources from the repository</h3>
<p>Building James with NetBeans is very easy as it comes with Subversion and Maven support already build in.
Maven is bundled with the IDE, but Subversion is not, so you will have to install Subversion yourself and NetBeans will be able to use it.
You can get more details on how to install and where to get Subversion from the NetBeans Help menu by clicking on <b>Help Contents</b> and from there go to the <b>IDE Basics-&gt;Version Control and File Hierarchy-&gt;Subversion</b> topic.
</p>
<p>For Linux users, Subversion is probably packaged by your distribution so use your distribution tools to install it (aptitude, yum, etc.)</p>
<p>Once you have Subversion, go to <b>Team-&gt;Subversion-&gt;Checkout</b> menu entry. <br />
You will see an dialog window used to enter the information about the Subversion repository you are going to use. It looks like this:</p>
<img src="./images/netbeans/netbeans-svn-checkout1.png" alt="" />
<p>In the Repository URL field enter the location for James repository and click Next.
You can use the following URL to get the master or development version:
<a class="externalLink" href="http://git-wip-us.apache.org/repos/asf/james-project.git">http://git-wip-us.apache.org/repos/asf/james-project.git</a>.<br />
After this you will be presented with another dialog window where you can configure which folders to check out and where to save them on your machine.</p>
<img src="./images/netbeans/netbeans-svn-checkout2.png" alt="" />
<p>If you supplied the above URL you can click Finish to get master version and start hacking.
You can choose another folder by clicking Browse. A new dialog window will open and from there you can browse
the whole subversion repository. I wanted to build James 3.0beta so I choosed james-serve-3.0-beta1 under james/server/tags/ folder. <br /></p>
<img src="./images/netbeans/netbeans-svn-checkout-browse.png" alt="" />
<p>After you click Finish NetBeans will checkout the sources. It will detect the Maven project and ask you if you wish to open the project.
If you open the project you will see in the Projects Window (CTRL+1 if not visible) something similar to the next image:<br /></p>
<img src="./images/netbeans/netbeans-james-project.png" alt="" />
</section>
<section>
<h3><a name="Building_the_project"></a>Building the project</h3>
<p> Building the project does not require too much work. Just go to Run-&gt;Build Project menu option.
Make sure that James is the main project (if you have other projects open) or NetBeans will build that project instead of James.
Once the build is finished you will find the binary distribution in container-spring/target directory. <br /></p>
<img src="./images/netbeans/james-build-dir.png" alt="" />
</section>
</section>
<section>
<h2><a name="Build_James_Source_from_other_IDEs"></a>Build James Source from other IDEs</h2>
<p>We will be happy to include on this page any other tutorial you could send
use about developing James with your favorite Integrated Development Environment.</p>
</section>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">Copyright &#169; 2006-2021
<a href="https://www.apache.org/">The Apache Software Foundation</a>.
All Rights Reserved.
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>