Hi,

See comments in-line...


Michael Haefele wrote:
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.

Apart from some issues with reporting plugins [1] it shouldn't matter whether you run it with maven 2 or 3, it's rather a question of which version of the site-plugin you're using. Version 3 of the site plugin is compatible with maven 2 and 3.


[1] http://maven.apache.org/plugins/maven-site-plugin/maven-3.html



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)

why not?

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)?

site:stage is just a local preview of site:deploy for which this information is needed. In particular relative links between modules are constructed using this information. There were lots of problems with this in older versions of the plugin, see [2] and linked issues. So even though in your particular case the distMngmt.site info is not directly needed, it is necessary to ensure that that the staged site is exactly the same as the deployed site.

[2] http://jira.codehaus.org/browse/MSITE-533


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/>

that doesn't sound right, do you have a test case?


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 can only guess but I assume that you have a complicated project structure, maybe with non-default directory layout? Did you read [3], especially the 'Note' under 'Staging and deploying'? Otherwise please provide a simple test project.


[3] http://maven.apache.org/plugins/maven-site-plugin/examples/multimodule.html


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.

This sounds weird, again a test project would help...


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...

Yeah, that definitely feels like a reasonable expectation... :)

HTH,
-Lukas


No?

Thanks,
Mike


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to