Hey,
Thanks for the example. This is quite similar to what I'm trying to do. But
if I do it like this, Maven will deploy my site under:
scp://.../${parent.groupId}/${parent.artifactId}/${parent.version}/../../../${project.groupId}/${project.artifactId}/${project.version}/${project.artifactId}/
I have no clue why the last artifactId is added.
Also, I have no use for the artifactId. At my company we have unique
groupIds for each project that would have a site.
Anyway, I think I can just create an archetype that sets the deployment URL.
This would let me to provide a default site.xml as well.
Lorant
On Fri, Aug 19, 2011 at 10:44, Thorsten Heit <[email protected]> wrote:
> Hi Lóránt,
>
> > However, requiring each project to do this is rather error prone, so I'd
> > like to define a pattern in the company parent POM, and have all
> projects
> > automatically derive their location from there.
> >
> > This doesn't work. If I set a location in our top-level POM to, say,
> > "scp://maven-sites/var/www/", sites will be published to folders under
> that
> > location based on their artifactId. This means that I get URLs like
> this:
> >
> > http://maven-sites.local/hello-parent/
> > http://maven-sites.local/hello-parent/hello-core/
> >
> > I have several problems with this:
> >
> > - The URLs I get are not very nice.
> > - The company POM's site gets published to the root location (
> > http://maven-sites.local/), which causes all kinds of troubles.
> > - If I have two projects with different groupIds, but with the same
> > artifactId, their sites will collide.
> >
> > Is there an easy way to solve this, or should all projects define their
> own
> > site locations?
>
> I'm doing something similar by using the following properties /
> definitions in my parent (company) pom:
>
>
> <properties>
> <!-- URL for deployable web sites: -->
>
>
> <distribution.repository.website>scp://myserver/var/apache2/2.2/htdocs/docs</distribution.repository.website>
>
> <!-- standard base URL for deployed web sites: -->
> <base.site.url>http://myserver/docs</base.site.url>
> </properties>
>
>
> <url>${base.site.url}/${project.groupId}/${project.artifactId}/${project.version}</url>
>
> <distributionManagement>
> ...
> <site>
> <id>releases-site</id>
> <name>Published web sites</name>
>
>
> <url>${distribution.repository.website}/${project.groupId}/${project.artifactId}/${project.version}</url>
> </site>
> </distributionManagement>
>
>
> This lets all projects that use my parent pom deploy their websites under
> the "/docs" subdirectory under my Apache's document root directory
> "/var/apache2/2.2/htdocs/".
>
>
> Note:
> The group Id isn't "splitted" in several subdirectories, i.e. you'll end
> up having "com.example/blah/1.0-SNAPSHOT" as path, not
> "com/example/blah/1.0-SNAPSHOT".
>
> Using the following default site.xml in my projects lets "mvn site-deploy"
> resolve parent relationship links by using the links/urls given in the
> parent pom:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <project xmlns="http://maven.apache.org/DECORATION/1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0
> http://maven.apache.org/xsd/decoration-1.0.0.xsd">
> <publishDate format="dd.MM.yyyy" position="right" />
> <version position="right" />
> <poweredBy>
> <logo name="Maven" href="http://maven.apache.org/"
> img="
> http://maven.apache.org/images/logos/maven-feather.png" />
> </poweredBy>
>
> <body>
> <menu inherit="true" />
>
> <menu ref="parent" />
> <menu ref="reports" />
> <menu ref="modules" />
> </body>
> </project>
>
>
>
> HTH
>
> Thorsten