Thursday, May 9, 2013

Maven Archetype for our Scala JavaEE project


As requested, we now have a Maven Archetype for our Scala/JavaEE application. It makes easier to generate new projects by using the boxdata as template.

Due to the incompatibility of licenses, I cannot propose it as a TomEE sub-module; I plan to create other examples of Rich Internet Applications with Apache friendly licenses and include them in the TomEE project as soon as my free time permits. ExtJS and HighCharts are free of charge for personal use only. If you want to develop a commercial application with them, you will need to buy the commercial licenses for it. Regardless, you are free to hack and use the code that I created in your own projects (Apache License). In fact, I will be glad to have your contribution!

Let's build our application.
  • First, locate the ".m2" directory. It should be one of the children of our home directory. 
  • Create an archetype-catalog.xml file with the following content. 
 <archetype-catalog xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd">  
  <archetypes>  
   <archetype>  
    <groupId>boxdata</groupId>  
    <artifactId>boxdata-archetype</artifactId>  
    <version>1.0-SNAPSHOT</version>  
    <repository>http://people.apache.org/~tveronezi/m2repository</repository>  
    <description>boxdata-like application template</description>  
   </archetype>  
  </archetypes>  
 </archetype-catalog>  

Go to the directory where you want to create your new project and execute...
 mvn archetype:generate  


You should see the list of all the archetypes available in your machine. The last one in this list should be boxdata-archetype.


Now choose your parameters...


Done. Your project is ready!


Linux users can run the application by executing...
 make start-tomee  

Windows users can follow this post: http://buildnplay.blogspot.ca/2012/12/building-jee-application-with-intellij.html. It will show how to run the TomEE server with IntelliJ.

Importing an existing project with IntelliJ

Tip. You don't need to download TomEE. When you run "mvn install" maven will download the bleeding-edge version of the server for you. The file will be available under <YOUR PROJECT>-resources\target\tomee-runtime.tar.gz.

In case you don't want to create the archetype-catalog.xml file, you can clone and build the archetype in your localhost. The source-code is available here: https://github.com/tveronezi/boxdata-archetype. Feel free to clone it. Please contribute!

The TomEE project is always looking for new contributions. Go check it out. Lots of fun! http://tomee.apache.org/

[]s,