Dienstag, 3. April 2012

Best practice for maven site generation in a multi module environment

One example how to decrease the time for creating the site of a maven multi module project
whizbang
|-- pom.xml
|-- core
|   `-- pom.xml
|-- gui
|   `-- pom.xml
|-- jmx
|   `-- pom.xml
`-- src
in the pom.xml from whizbang you normally have something like this:
            
                core
                gui
                jmx
            
this config would always generate the sites for all sub modules when you call mvn site in the folder of whizbang. depending on the size of the project and configured plugins this can be very time consuming. so we decided to work only on profiles. We removed the module section completely and defined 2 profiles.
    
        
            default
            
                true
            
            
                core
                gui
                jmx
            
        
        
            writeDoc
            
                false
            
            
                
                    
                        org.apache.maven.plugins
                        maven-site-plugin
                        3.0
                        
                            ${site.output.directory}
                            
                                
                                    org.apache.maven.plugins
                                    maven-project-info-reports-plugin
                                    2.4
                                    
                                        false
                                        false
                                    
                                    
                                        index
                                    
                                
                            
                        
                    
                            
            
        
    
mvn clean install has the default behaviour. And when you want to write doc and test the site locally you can easily use this command mvn -P writeDoc site this generates only the site for whizbang project and not for sub projects.

Keine Kommentare:

Kommentar posten