When trying to publish my open source projects to gh-pages with
mvn site
there have been lots of obstacles recently due to changes in the way maven and github pages works.
After studying
Here are some of the needed prerequisites i found and issues i ran into:
prerequisites
issues
not even mentioning work arounds i have to use for ssh-wagon and Java8 javadoc and others
The plugins used are IMHO a "moving target". Something that worked a few months ago in my experience will not work today. So I keep fixing my pom.xml files to keep up and the files grow longer and longer.
See e.g. https://github.com/BITPlan/com.bitplan.simplerest/blob/master/pom.xml
For my internal projects I use a parent pom to make sure that the projects have a common configuration. For the open source projects I did not find a way to use a parent pom for a group of projects yet.
I would like to make sure that a working configuration that i found is "transferred" to other configurations. I am thinking e.g. of
I assume this is a pretty common problem and there are experiences by SO users on how to tackle this issue accross different project.
What would be a good approach and what tools would be useful?
Examples for moving targets
As suggested by khmarbaise there is now a common parent pom in place.
mvn site
can be run for all projects using this parent pom with a common set of reports and the result will be transmitted to the corresponding github pages.
A projects specific pom can now be as short as just 25 lines
I am now actually in the process of creating a check script for the pom files and a generate script for the README.md files. This is one of the useful snippets:
usage example:
checkghpages https://github.com/BITPlan com.bitplan.simplerest
Check that the gh-pages exist and create after asking
#
# check the github pages for the given project
#
# param 1: base url in github
# param 2: project name/directory
#
checkghpages() {
local l_baseurl="$1"
local l_project="$2"
cd $ws/$l_project
git ls-remote --heads | grep gh-pages > /dev/null
if [ $? -ne 0 ]
then
color_msg $red "github pages branch gh-pages missing for $l_project"
color_msg $blue "shall i create the branch gh-pages for $l_project?"
read answer
case $answer in
y|Y|yes|Yes|j|Ja)
color_msg $blue "creating gh-pages branch for $l_project ..."
cd /tmp
# https://gist.github.com/ramnathv/2227408
git clone $l_baseurl/$l_project
cd $l_project
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "<a href='$l_baseurl/$l_project'>Initial GitHub Page for $l_project</a>" > index.html
git add .
git commit -a -m "First pages commit by checkos script"
git push origin gh-pages
cd $ws/$l_project
git pull
;;
esac
else
color_msg $green "github pages branch gh-pages for $l_project exists✓"
fi
}