Wednesday, September 11, 2013

Maven Archetype for OSB Project

This is a maven archetype (osb-archetype-blog.zip) for creating an OSB project that Eclipse and Maven can share.

Two things to note about the archetype:

1. I have a local OSB 11.1.1.6 installed, so the POM references to some jar files are 11.1.1.6 specific. You may need to adjust it.
2. If you just want to create setup an OSB project for Eclipse, you can remove the entire plugin section in the POM file. But then, there is no point of using Maven to create the project. The "value" of Maven in this case is it allows you to build OSB jar from the command line, and also allows you to use Eclipse to work on the project.

To place the archetype in your local repository, you can just run "mvn install" after unzip the file.

To create a new OSB project, run something like "mvn archetype:generate -DgroupId=myOsbGrp -DartifactId=myOsbProj", then select the new archetype. For me the # is 832, yours can be different depends on how many archetypes you already have in your repository.

Once the project is created, it will have a folder structure like below:

myOsbProj
│   pom.xml

├───src
│   └───main
│       └───resources
│           ├───OSBConfiguration
│           │   │   .project
│           │   │
│           │   └───.settings
│           │           com.bea.alsb.core.prefs
│           │           org.eclipse.wst.common.component
│           │           org.eclipse.wst.common.project.facet.core.xml
│           │           org.eclipse.wst.validation.prefs
│           │
│           └───OSBProject
│               │   .project
│               │
│               ├───.settings
│               │       org.eclipse.wst.common.component
│               │       org.eclipse.wst.common.project.facet.core.xml
│               │       org.eclipse.wst.validation.prefs
│               │
│               ├───BusinessServices
│               │       BusinessService1.biz
│               │
│               ├───ProxyServices
│               │       ProxyService1.proxy
│               │
│               └───Resources
│                       helloworld.wsdl

From here, you can use Eclipse to import the existing project (pick "main/resources" directory, Eclipse will sort out the rest). You can check in/check out the source to SVN.

The new pom.xml file allows you to build the OSB project from the command line without using Eclipse, therefore make the automated build (CI) possible.

The archetype can be further improved to add deployment (deploying the OSB jar to a server). I'm a beginner of Maven. That would be a future project at some point.