[erlang-questions] Erlang unit testing and continuous integration

Paul Guyot <>
Sun Oct 19 18:09:31 CEST 2008


Le 18 oct. 08 à 12:32, Dan Rubino a écrit :

> Hi Paul,
>
> That's exactly what I was hoping for! Thanks.
>
> Just installed it all and converted my project to the maven format.
>
> Everything builds, tests run and docs generated (great)....but when I
> run 'mvn package' it creates the project xyz.zip except I don't see  
> the
> boot files generated with it? (only /ebin /src /doc /include)
>
> Am I missing a step here? Normally I would run something like:
> 	systools:make_script("release-1.0").
>
> Followed by:
>
> 	erl -boot release-1.0
>
> To start the application and all its dependencies.
>
> If I could get Maven to take care of this step that would be  
> fantastic.
> I cant see any other goals listed which may take care of this.

Actually, the maven plugin only handled Erlang OTP applications  
(packaging: erlang-otp). Each application must have its own pom.xml,  
and dependencies between applications are declared with lines like:

   <dependencies>
       <dependency>
           <groupId>com.semiocast.lib</groupId>
           <artifactId>aspell</artifactId>
           <version>0.1</version>
           <type>erlang-otp</type>
       </dependency>
       <dependency>
           <groupId>com.semiocast.lib</groupId>
           <artifactId>sqlite</artifactId>
           <version>0.1</version>
           <type>erlang-otp</type>
       </dependency>
...
   </dependencies>

Our OTP release was generated by a custom pom.xml with a Makefile,  
but I cleaned that up and implemented everything in the maven plug- 
in. You just need to update the plug-in to get these new features.  
Each release must have its own pom.xml as well and are packaged as  
"erlang-rel". You must declare the applications composing the release  
with the dependencies XML element and the applications must be  
installed in your repository (with mvn install).

The release pom.xml typically goes like this:
<project>
   <packaging>erlang-rel</packaging>
...
   <dependencies>
   ...
   </dependencies>

   <build>
     <plugins>
       <plugin>
         <groupId>net.sf.maven-erlang</groupId>
         <artifactId>erlang-plugin</artifactId>
         <extensions>true</extensions>
         <configuration>
           <!-- Optional parameter: run dialyzer (defaults to false) -->
           <useDialyzer>true</useDialyzer>
           <!-- Optional parameter: also run dialyzer on the  
dependencies (defaults to true) -->
           <dialyzerWithDependencies>true</dialyzerWithDependencies>
           <!-- Optional parameter: fail on dialyzer warnings  
(defaults to false) -->
           <dialyzerWarningsAreErrors>true</dialyzerWarningsAreErrors>
           <!-- Optional parameter: release name (defaults to  
artifactId) -->
           <releaseName>semiocast</releaseName>
           <!-- Optional parameter: make_script options -->
           <makeScriptOptions><param>{variables, [{"TARGET", "$ 
{project.build.directory}/lib"}]}</param></makeScriptOptions>
         </configuration>
       </plugin>
     </plugins>
   </build>
</project>

releaseName is the name of your .rel file (without the .rel). It  
should be in src/main/erlang/ subdirectory. The makeScriptOptions can  
be used to pass options such as where the applications are.  
'{variables, [{"TARGET", "${project.build.directory}/lib"}]}' is a  
convenient default value, since the maven plug-in will unzip your  
dependencies (your applications) in ${project.build.directory}/lib.  
The dialyzer stuff here allows you to run dialyzer on the whole  
release (and therefore check inter-application calls).

To run the application, you only need to do:

erl -boot_var TARGET lib -boot releaseName

Paul




More information about the erlang-questions mailing list