Thursday, November 8, 2007

JDeveloper project with Maven / Continuum

If you work on jdeveloper project in teams then you probably experienced that someone checked in bad code or not all the code so the next day nobody can compile the project. Then it is necessary to have a continious build tool and it also does unit tests on the code so you can pro-active react. These build are all open source so it can't be the money if you don't use it in your projects.

The first step to have a maven repository. This stores the javax and oracle jars which are needed for compilation, You have to upload the needed jars into the repos. the others non commercial jars are downloaded automaticaly from public repositories and stored in the local repos. For a good description how to setup a repository see this guide on the theserverside. I use artifactory.

If you work in teams I think you already have subversion or cvs. This is necessary so maven can check out the code every X minutes for a complete rebuild.

Let's download maven

Now we are ready to setup a jdeveloper project . Maven needs a typical structure for a normal project and a webapp project. see the picture below. So you need to change the jdeveloper projects to this directory structure.

You also can do the other way around, make the directory structure, put in your code. Let maven compile the workspace and the download a maven plugin from some adf faces developers. And let this plugin generate jpr files. check out with subversion this url for the plugin
Let's make a trunc folder with a model and viewcontroller subfolders. In the model we have a src folder with two subfolder main and test. In main\java you put in your java and xml's and in test your unit tests. The viewcontroller structure is a bit different you have here a webapp folder in src/main.

Now we ready the make the maven pom files. The first we make is the main pom where we put in the order of compiling the sub projects and shared used jar files. This pom.xml is located in the trunk directory

Here you see we have two projects model and view controller and one shared jar.
the model pom is a bit different and is located in the model folder

Here you have extra configuration elements for the issue management , in this case I use jira . If the build fails it makes a issue to the developer in jira . The second is subversion scm connection to check out the model code. The third is the continuum configuration who is has to email if there are changes in the build proces.
The build configuration is very import for adf bc ( bc4j) projects because the xml files are very important.

The viewcontroller pom looks like this

Dependency is now the model project

Now we can build the application in maven. the last step is installing continuum where we can load the main pom.xml and we now can configure when and how often it has to build .We also get a total overview about over build projects.

No comments:

Post a Comment