Friday, May 27, 2016

Sources for a small maven multi-module project


This is a multi-module maven project that was created according to the sonatype maven tutorial, which can be found here: https://books.sonatype.com/mvnex-book/reference/multimodule.html.

The sources for the project can cloned from here: https://wmmnpr@bitbucket.org/wmmnpr/weather-parent.git

I created it so that I could experiment with deploying a webapp (weather-webapp), which was part of a maven multi-module project, to weblogic.

It appears that the source code referred to in the apache documentation (https://maven.apache.org/guides/mini/guide-multiple-modules.html) is no longer available.

Type "mvn install" in the weather-parent directory and all the modules should be built and deployed to weblogic, which you will undoubtly  have to reconfigured or remove. To make it work without weblogic just delete the weblogic-maven-plugin plugin and run it using jetty as in: mvn jetty:run

I threw in the plugin for no special reason other than that I needed a sample plugin project as well. The plugin was created with the "maven-archetype-plugin" and the webapp with the "maven-archetype-webapp". Its "touch" goal should execute during the compile phase of the default lifecycle; see the pom of weather-service module. Eclipse's Lifecycle Mapping show this nicely.



Once deployed, the webapp can be accessed by calling:  http://host:port/weather-webapp/weather, which should show "Windy".

Sorry, it's pretty boring but I was trying to keep it simple.