About Custom Configuration of historic support for Multimodules project

Thanks to the Checkstyle plugin team for this part of documentation

Setup a custom configuration for Multimodules project

Configuring the Dashboard plugin for use within large multimodule projects can be done, but will require a little setup.

Example will use a mysterious project called 'whizbang'.

       
whizbang
|-- pom.xml
|-- core
|   `-- pom.xml
|-- gui
|   `-- pom.xml
|-- jmx
|   `-- pom.xml
`-- src
       
      	

First: setup a sub project to house your build tools.

       
whizbang
|-- pom.xml
|-- build-tools
|   `-- pom.xml
|-- core
|   `-- pom.xml
|-- gui
|   `-- pom.xml
|-- jmx
|   `-- pom.xml
`-- src
       
      	

Next, include the resources you want in the build-tools jar file. In this example, the build-tools jar will contain the resources, such as your custom dashboard xml config file and other config files as Checkstyle .... .


whizbang
|-- pom.xml
|-- build-tools
|   |-- src
|   |   `-- main
|   |       `-- resources
|   |           `-- whizbang
|   |               |-- myDashboardConfig.xml
|   |               |-- checkstyle.xml
|   |               `-- LICENSE.TXT
|   `-- pom.xml
|-- core
|-- gui
|-- jmx
`-- src
       
      	

TIP: put the resources into a subdirectory that you can ensure will be unique, and not conflict with anyone else.

Now, include the dashboard configuration in the top level pom.xml


<project>
	[....]
	<build>
		<extensions>
			<extension>
				<groupId>com.example.whizbang</groupId>
				<artifactId>build-tools</artifactId>
				<version>1.0</version>
			</extension>
		</extensions>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>dashboard-maven-plugin</artifactId>
				<version>1.0-SNAPSHOT</version>
				<configuration>
					<dialect>
						org.hibernate.dialect.DerbyDialect
					</dialect>
					<driverClass>
						org.apache.derby.jdbc.ClientDriver
					</driverClass>
					<connectionUrl>
						jdbc:derby://localhost:1527/myDB;create=true
					</connectionUrl>
					<username>usr</username>
					<password>usr</password>
					
					<configLocation>whizbang/myDashboardConfig.xml</configLocation>

					
				</configuration>
				<dependencies>
					<dependency>
						<groupId>org.apache.derby</groupId>
						<artifactId>derbyclient</artifactId>
						<version>10.2.1.6</version>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
	</build>
	<reporting>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>dashboard-maven-plugin</artifactId>
				<version>1.0-SNAPSHOT</version>
			</plugin>
		</plugins>
	</reporting>
</project>
       
      	

Once you are done with that, ensure that you do not include the dashboard-maven-plugin in your sub modules, as their definition and configuration, will override the top level parent pom's definition.

Based on the Dashboard plugin configuration above, the value of <configLocation> will be resolved from the classpath. The build-tools jar was included in the classpath when it was declared as an extension of the project.

Note: For the classpath reference, the build-tools was referred to as an extension and not as a plugin dependency. This is due to the fact that if it is declared as a plugin dependency, Maven will not download it from the internal repository and would just look for it in ibiblio.

Lastly, kick off a build of the site.

	mvn site
	mvn dashboard:dashboard
	

Every sub project will use the same Dashboard setup and configuration.