The question on using site with aggregated projects got me to trying out the
maven 3 version of the site plugin..

Thought I'd post a little list of the steps required and a report card.

My use case is I want to generate a site in some directory in a nightly CI
build for an aggregated project.

I don't really care what the site looks like beyond maybe adding any
reporting plugins that sound interesting.
I certainly don't want to deploy it anywhere as it's already
web accessible as an artifact of the nightly build (this has the added
benefit of being able to compare Tuesday's site with Wednesday's site).
Basically i want to run the plugin and use whatever the default output
is....

In Maven 2, this use case didn't fare very well (specifically this use case.
 If this is an outlandish use case, that's fine).
Basically I jumped through 4 or 5 flaming hoops and gave up (again, it's a
nice to have, but not part of core business in any way, so the last 3 hoops
were more out of stubbornness than a good use of my time).

So hopefully Maven 3 would be a little more forgiving.

To get started, I followed the link sent in the other post.  (
http://maven.apache.org/**plugins/maven-site-plugin/faq.**
html#Why_dont_the_links_**between_parent_and_child_**
modules_work_when_I_run_mvn_**site<http://maven.apache.org/plugins/maven-site-plugin/faq.html#Why_dont_the_links_between_parent_and_child_modules_work_when_I_run_mvn_site>
)

I need to use site:stage, but this requires the site to be generated...

So...
mvn clean site:site && mvn site:stage  (mvn clean site:site site:stage does
not work well I discovered)
Yields:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-site-plugin:3.0:stage (default-cli) on
project pep-parent-dep-mgmt: Missing site information in the distribution
management of the project pep-parent-dep-mgmt
(com.pep:pep-parent-dep-mgmt:3.10-SNAPSHOT) -> [Help 1]

So I'll count this as Hoop #1.  Why does maven need this information (as in,
why can't maven leave this blank or put in a "fix-me" value)?

I tried adding
<distributionManagement>

    <site>
      <id>www.yourcompany.com</id>
      <url>scp://www.yourcompany.com/www/docs/project/</url>
    </site>
  </distributionManagement>

, straight out of
http://maven.apache.org/plugins/maven-site-plugin/usage.html#Deploying_a_Site
(even
though i'm not actually deploying).
But this eventually causes some weird directory names in the site links
(they include the "scp://...."), so I took that out and just used
<url/>

This one actually deployed everything except the grandparent module  (we
have a grandparent, a parent which has grandparent as parent, and an
aggregating project, which does not have the parent or grandparent as a
parent) to target/staging/../../../../ (which turned out to be just above my
~ directory).  I don't know where all the ../../../.... came from (maybe the
<relativePath> in the <parent> tag?).

I finally goldilocked on
<url>mysite</url>

Which doesn't really make any sense, but seems to do the least crazy to the
staging directory structure..
I added this to the aggregating project and the grandparent project

mvn clean site:site && mvn site:stage

This now works except the grandparent project doesn't seem to have it's own
directory (clicking on the module link takes you to the staging directory)..
 But certainly good enough for my purposes..

In summary, I'd probably give the 3.0 site plugin a B- for this use case,
which is a HUGE improvement over maven 2.

My main issue is with configuring the <site> tag, which seems like
an unnecessary step if site:stage doesn't need it (especially since getting
it wrong can do odd things to where the files are staged).
It would be great if this defaulted to some safe value.

....or if someone could suggest some safe value, that would be awesome.
It looks like if I use file:// or scp:// as suggested by
http://maven.apache.org/plugins/maven-site-plugin/usage.html#Deploying_a_Site
it
starts doing really strange things with the directories.

Again, it just feels like one should be able to run mvn site:stage and get a
meaningful result where all the links make sense...
No?

Thanks,
Mike

Reply via email to