Multi module POM - creating a site that works

前端 未结 9 1850
名媛妹妹
名媛妹妹 2020-12-08 22:06

I have a multi module application, and I’m trying to generate a Maven site for this app.

I have an aggregating POM that holds all the child modules, an inheritance PO

9条回答
  •  失恋的感觉
    2020-12-08 22:19

    At http://wiki.bitplan.com/index.php/Multi-Module_Maven_with_github_pages you'll find a detailed analysis and example in the context of github-pages. See also Multi-module example of using mvn site-deploy with github pages

    Whats the work-around?

    • Do not use the plugin!
    • git clone or pull the gh-pages to a local folder
    • mvn site:stage to a temporary staging directory
    • rsync the results into the git local folder
    • check in the local folder
    • have a cup of coffee or drink a beer / be happy

      Do not use the plugin!

    • It's slow (as in really slow ... 18 minutes for the sample project)

    • It's not reliable (as in 500 HTML Codes)

    • It's not maintained well (as in [https://github.com/github/maven-plugins/issues 57 open issues as of 2018-08]

    • It's superflous (see below) Even the committer's don't use it any more (as in a personal mail I got today ..)
    #
    # createSite
    #   ws: global variable pointing to workspace 
    #   param 1: l_project - project name/directory
    #   param 2: l_ghpages - directory where gh-pages branch has been git cloned/pulled
    #   param 3: l_modules - non-empty for a multi-module project (e.g. containing the list of modules)
    #
    createSite() {
      local l_project="$1"
      local l_ghpages="$2"
      local l_modules="$3"
    
      color_msg $green "creating site for $l_project $l_modules"
      cd $ws/$l_project
        stage=/tmp/stage$$
        sitelog=/tmp/sitelog$$.txt
        rm -rf $stage
        # the stagingDirectory needs to be subdirectory 
        mkdir -p $stage/$l_project
    
        # run the staging of the site against this directory and log the results
        mvn -U clean install site site:stage -DstagingDirectory=$stage/$l_project | tee $sitelog
    
        # rsync the result into the github-pages folder
        rsync -avz --del $stage/* $l_ghpages/$l_project/
    
        # is this a multi module project?
        if [ "$l_modules" != "" ]
        then
            cd $l_ghpages/$l_project/
            if [ ! -f index.html ]
            then
    cat << EOF > index.html
    
    
    
       
       
    
    
       

    This is a multimodule mvn site click below to get to the index.html of $l_project

    EOF fi # add potentially new files git add * # commit results git commit -m "checked in by checksite script" # push results git push fi if [ "$debug" = "false" ] then rm -rf $stage rm $sitelog fi }

提交回复
热议问题