pekko/akka-docs/dev/building-akka.rst

135 lines
3.3 KiB
ReStructuredText
Raw Normal View History

2011-04-27 09:34:11 +12:00
.. highlightlang:: none
.. _building-akka:
###############
Building Akka
###############
2011-04-09 19:55:46 -06:00
This page describes how to build and run Akka from the latest source code.
2011-04-20 14:09:48 +12:00
.. contents:: :local:
2011-04-09 19:55:46 -06:00
Get the source code
2011-04-27 09:34:11 +12:00
===================
Akka uses `Git`_ and is hosted at `Github`_.
2011-04-09 19:55:46 -06:00
2011-04-27 09:34:11 +12:00
.. _Git: http://git-scm.com
.. _Github: http://github.com
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
You first need Git installed on your machine. You can then clone the source
2011-07-12 11:53:35 +12:00
repository from http://github.com/jboner/akka.
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
For example::
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
git clone git://github.com/jboner/akka.git
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
If you have already cloned the repository previously then you can update the
2011-04-20 14:09:48 +12:00
code with ``git pull``::
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
git pull origin master
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
sbt - Simple Build Tool
2011-04-27 09:34:11 +12:00
=======================
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
Akka is using the excellent `sbt`_ build system. So the first thing you have to
do is to download and install sbt. You can read more about how to do that in the
`sbt setup`_ documentation.
2011-04-27 09:34:11 +12:00
2011-07-12 11:53:35 +12:00
.. _sbt: https://github.com/harrah/xsbt
.. _sbt setup: https://github.com/harrah/xsbt/wiki/Setup
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
The sbt commands that you'll need to build Akka are all included below. If you
want to find out more about sbt and using it for your own projects do read the
`sbt documentation`_.
2011-04-27 09:34:11 +12:00
2011-07-12 11:53:35 +12:00
.. _sbt documentation: https://github.com/harrah/xsbt/wiki
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
The Akka sbt build file is ``project/AkkaBuild.scala``.
2011-04-09 19:55:46 -06:00
Building Akka
2011-04-27 09:34:11 +12:00
=============
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
First make sure that you are in the akka code directory::
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
cd akka
2011-04-09 19:55:46 -06:00
Building
2011-04-27 09:34:11 +12:00
--------
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
To compile all the Akka core modules use the ``compile`` command::
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
sbt compile
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
You can run all tests with the ``test`` command::
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
sbt test
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
If compiling and testing are successful then you have everything working for the
latest Akka development version.
2011-04-09 19:55:46 -06:00
Publish to local Ivy repository
2011-04-27 09:34:11 +12:00
-------------------------------
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
If you want to deploy the artifacts to your local Ivy repository (for example,
2011-07-12 11:53:35 +12:00
to use from an sbt project) use the ``publish-local`` command::
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
sbt publish-local
2011-04-09 19:55:46 -06:00
Publish to local Maven repository
2011-04-27 09:34:11 +12:00
---------------------------------
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
If you want to deploy the artifacts to your local Maven repository use::
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
sbt publish
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
sbt interactive mode
2011-04-27 09:34:11 +12:00
--------------------
2011-04-09 19:55:46 -06:00
2011-04-20 14:09:48 +12:00
Note that in the examples above we are calling ``sbt compile`` and ``sbt test``
2011-07-12 11:53:35 +12:00
and so on, but sbt also has an interactive mode. If you just run ``sbt`` you
enter the interactive sbt prompt and can enter the commands directly. This saves
2011-04-20 14:09:48 +12:00
starting up a new JVM instance for each command and can be much faster and more
convenient.
2011-04-09 19:55:46 -06:00
2011-04-27 09:34:11 +12:00
For example, building Akka as above is more commonly done like this::
2011-04-20 14:09:48 +12:00
% sbt
2011-07-12 11:53:35 +12:00
[info] Set current project to default (in build file:/.../akka/project/plugins/)
[info] Set current project to akka (in build file:/.../akka/)
2011-04-20 14:09:48 +12:00
> compile
...
> test
...
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
sbt batch mode
2011-04-27 09:34:11 +12:00
--------------
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
It's also possible to combine commands in a single call. For example, testing,
and publishing Akka to the local Ivy repository can be done with::
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
sbt test publish-local
2011-04-09 19:55:46 -06:00
.. _dependencies:
2011-04-09 19:55:46 -06:00
Dependencies
2011-04-27 09:34:11 +12:00
============
2011-04-09 19:55:46 -06:00
2011-07-12 11:53:35 +12:00
You can look at the Ivy dependency resolution information that is created on
``sbt update`` and found in ``~/.ivy2/cache``. For example, the
``.ivy2/cache/se.scalablesolutions.akka-akka-cluster-compile.xml`` file contains
the resolution information for the akka-cluster module compile dependencies. If
2011-04-27 09:34:11 +12:00
you open this file in a web browser you will get an easy to navigate view of
dependencies.