[erlang-questions] Erlang and Maven
Fri Sep 22 10:14:42 CEST 2006
For those interested in the Maven Erlang plugin I'm working on, I'm pleased
to announce that the project is up and running at sourceforge (http://
maven-erlang.sourceforge.net). Please bear in mind that the documentation is
still very incomplete. I haven't decided on the licence yet (I know, it's
bad...) but I guess it'll be LGPL, Apache or BSD.
- project setup (via the erlang-archetype plugin)
- project compilation
- compile and run test cases (implemented in the project lifecycle : tests
will always be run when you package or deploy your project, for instance)
- project packaging (OTP style and zipped, including documentation with
- project deployment (via SCP, WebDAV, file copy, etc.)
Plugin Installation: via SVN only for the moment. If you have maven
installed, just type "mvn install" in both the plugins directories
(erlang-plugin and erlang-archetype)
Documentation (still very basic):
A word about test cases:
With JUnit, unit tests are separated from the rest of the code (in their own
classes, obviously), and Maven mainains a separation between the
corresponding .java files (src/test/java) from the rest of the code
I wanted to recreate this in Erlang as I don't like to put test code in my
modules. So I came up with this:
- during the "compile" phase, Maven-Erlang generates a "normal" Emakefile
for the main .erl files then calls "erl -make"
- after that, during the "test" phase, Maven-Erlang generates another
Emakefile, which also compiles the test files (and adds the correct include
paths). It also adds the compile_all flag. Basically, it lets you put all
your test code in separate modules (and test every single function if you
choose to). Finally, Maven-Erlang calls the test/0 function for every module
ending with the "_test" suffix (the suffix can be changed in the POM file).
I'd very much like your opinion on this design choice :) I think it works
nicely with EUnit 2.
Future features should include Erlang specific report generations and
automatic deployment on an erlang node (including setting up the node if
needed). I've also started to look into erlrt for transitive dependency
Thanks for your feedback
On 9/12/06, Olivier Sambourg <> wrote:
> 2006/9/11, Arnaud Bailly <>:
> > Chandru < > writes:
> > >>
> > >
> > > I don't know anything about Maven, but maybe you can use the OTP
> > structure
> > > for your system installation and the "mavenish" structure for your
> > code
> > > repository?
> > I agree. The OTP structure could be constructed from the maven
> > standard layout using assembly plugin or even a custom artefact
> > type. For simplicity's and consistency's sake, it is better to keep
> > adhering to maven's structure.
> I also agree (it does seem obvious now...)
> 2006/9/11, Vance Shipley < >:
> > On 10/09/06, Olivier Sambourg < > wrote:
> > >
> > >If we take a look at various OTP applications, the common directory
> > >structure seems to be :
> > >
> > >application/
> > >|-> src/ (source files, flat)
> > >|-> include/ (include files...)
> > >|-> doc/ (documentation)
> > >|-> ebin/ (beam files)
> > The convention in OTP when mixing languages is to have a "c_src"
> > directory. For example:
> > $ ls lib/erlang/lib/asn1- 188.8.131.52
> > c_src ebin examples priv src
> > In this case there is a ddll driver and the C source is in c_src.
> > The library with the driver code is in:
> > lib/erlang/lib/asn1- 184.108.40.206/priv/lib/asn1_erl_drv.so
> > Another example is the IC application which uses java:
> > $ ls lib/erlang/lib/ic-4.2.11
> > c_src ebin examples include java_src priv src
> Thank you for the information :)
> I've started working on the plugin, slowly at first as I'm still
> struggling with Maven's documentation... For the moment, it's capable of
> generating an Emakefile with various user defined options and use it to
> compile the source files. Quite dull actually :)
> Next step will be packaging, automatically running test cases and
> generating the edoc (not necessarily in this order). Then there'll be
> dynamic code loading (Cargo really seems a good idea...) and dependencies
> management (REPOS is still my only lead).
> I've also started an archetype plugin (a special breed of maven plugins
> used to set up a typical project, such as web apps, j2ee, etc.). It creates
> the project directory structure, along with exemple sources files and a
> basic POM file, so you can start coding right away...
> I'll let you know when I make significant progress.
> Thanks for the help
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions