MNG-661: added link between parent project and modules

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vincent Siveton 2005-07-29 12:37:56 +00:00
parent 7a26239e7c
commit f5130c14a2
19 changed files with 603 additions and 2 deletions

View File

@ -151,6 +151,12 @@ public class DoxiaMojo
*/
private String locales;
/**
* @parameter expression="${addModules}"
* default-value="true"
*/
private boolean addModules;
/**
* @parameter expression="${component.org.codehaus.plexus.siterenderer.Renderer}"
* @required
@ -443,6 +449,26 @@ public class DoxiaMojo
{
copyDirectory( resourcesDirectory, localeOutputDirectory );
}
// Copy the generated site in parent site if needed to provide module links
if ( addModules )
{
MavenProject parentProject = project.getParent();
if ( parentProject != null )
{
// TODO Handle user plugin configuration
File parentSiteDir = new File( parentProject.getBasedir(), parentProject.getBuild().getDirectory()
+ File.separator + "site" + File.separator + project.getArtifactId() );
if ( !parentSiteDir.exists() )
{
parentSiteDir.mkdirs();
}
File siteDir = new File( outputDirectory );
FileUtils.copyDirectoryStructure( siteDir, parentSiteDir );
}
}
}
}
catch ( MavenReportException e )
@ -484,8 +510,9 @@ public class DoxiaMojo
private String getReportsMenu( Locale locale )
{
StringBuffer buffer = new StringBuffer();
// TODO i18n
buffer.append( "<menu name=\"Project Documentation\">\n" );
buffer.append( "<menu name=\"" );
buffer.append( i18n.getString( "site-plugin", locale, "report.menu.projectdocumentation" ) );
buffer.append( "\">\n" );
buffer.append( " <item name=\"" );
buffer.append( i18n.getString( "site-plugin", locale, "report.menu.about" ) );
buffer.append( " " );
@ -524,6 +551,59 @@ public class DoxiaMojo
}
}
/**
* Generate a menu for modules
*
* @param locale the locale wanted
* @return a XML menu for modules
*/
private String getModulesMenu( Locale locale )
{
StringBuffer buffer = new StringBuffer();
buffer.append( "<menu name=\"" );
buffer.append( i18n.getString( "site-plugin", locale, "report.menu.projectmodules" ) );
buffer.append( "\">\n" );
List modules = project.getModules();
if ( project.getModules() != null )
{
for (Iterator it = modules.iterator(); it.hasNext();)
{
String module = (String)it.next();
buffer.append( " <item name=\"" );
buffer.append( module );
buffer.append( "\" href=\"" + module + "/index.html\"/>\n" );
}
}
buffer.append( "</menu>\n" );
return buffer.toString();
}
/**
* Generate a menu for the parent project
*
* @param locale the locale wanted
* @return a XML menu for the parent project
*/
private String getProjectParentMenu( Locale locale )
{
StringBuffer buffer = new StringBuffer();
buffer.append( "<menu name=\"" );
buffer.append( i18n.getString( "site-plugin", locale, "report.menu.parentproject" ) );
buffer.append( "\">\n" );
buffer.append( " <item name=\"" );
buffer.append( project.getParent().getArtifactId() );
buffer.append( "\" href=\"../index.html\"/>\n" );
buffer.append( "</menu>\n" );
return buffer.toString();
}
/**
* @todo should only be needed once
*/
@ -566,6 +646,19 @@ public class DoxiaMojo
props.put( "reports", getReportsMenu( locale ) );
}
if ( project.getParent() != null )
{
props.put( "parentProject", getProjectParentMenu( locale ) );
}
if ( addModules )
{
if ( ( project.getModules() != null ) && ( project.getModules().size() > 0 ) )
{
props.put( "modules", getModulesMenu( locale ) );
}
}
// TODO: interpolate ${project.*} in general
if ( project.getName() != null )

View File

@ -7,6 +7,8 @@
<links>
<item name="${project.name}" href="${project.url}"/>
</links>
${parentProject}
${modules}
${reports}
</body>
</project>

View File

@ -28,6 +28,9 @@ report.information.description2=on behalf of the project.
report.information.sectionTitle=Overview
report.information.column.description=Description
report.information.column.document=Document
report.menu.projectdocumentation=Project Documentation
report.menu.parentproject=Parent Project
report.menu.projectmodules=Modules
report.menu.about=About
report.menu.projectinformation=Project Info
report.menu.projectreports=Project Reports

View File

@ -28,6 +28,9 @@ report.information.description2=le projet lui-m
report.information.sectionTitle=Vue d'ensemble
report.information.column.description=Description
report.information.column.document=Document
report.menu.projectdocumentation=Documentation sur le projet
report.menu.parentproject=Projet parent
report.menu.projectmodules=Modules
report.menu.about=A propos de
report.menu.projectinformation=Info Projet
report.menu.projectreports=Rapports Projet

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.plugin.site.test8</groupId>
<artifactId>site-plugin-test8</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.plugin.site.test8</groupId>
<artifactId>framework</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Framework module for the Maven Site Plugin Test8 MNG-661 issue</name>
<description>Framework module to test the MNG-661 issue</description>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,13 @@
package org.apache.maven.plugin.site.test8;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,12 @@
------
Configuring Site Plugin
------
Vincent Siveton
------
29 July 2005
------
Site Plugin MNG-661 (framework module)
Todo

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="Maven Site">
<bannerLeft>
<name>Maven Site</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
<bannerRight>
<src>http://maven.apache.org/images/maven-small.gif</src>
</bannerRight>
<body>
<links>
<item name="Maven 2" href="http://maven.apache.org/maven2/"/>
</links>
${parentProject}
${modules}
${reports}
</body>
</project>

View File

@ -0,0 +1,38 @@
package org.apache.maven.plugin.site.test8;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.plugin.site.test8</groupId>
<artifactId>site-plugin-test8</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.maven.plugin.site.test8</groupId>
<artifactId>framework2</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Framework2 module for the Maven Site Plugin Test8 MNG-661 issue</name>
<description>Framework2 module to test the MNG-661 issue</description>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,13 @@
package org.apache.maven.plugin.site.test8;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,12 @@
------
Configuring Site Plugin
------
Vincent Siveton
------
29 July 2005
------
Site Plugin MNG-661 (framework2 module)
Todo

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="Maven Site">
<bannerLeft>
<name>Maven Site</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
<bannerRight>
<src>http://maven.apache.org/images/maven-small.gif</src>
</bannerRight>
<body>
<links>
<item name="Maven 2" href="http://maven.apache.org/maven2/"/>
</links>
${parentProject}
${modules}
${reports}
</body>
</project>

View File

@ -0,0 +1,38 @@
package org.apache.maven.plugin.site.test8;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

View File

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugin.site.test8</groupId>
<artifactId>site-plugin-test8</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2005</inceptionYear>
<name>Maven Site Plugin Test8 MNG-661 issue</name>
<description>Test the MNG-661 issue</description>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<developers>
<developer>
<id>vsiveton</id>
<name>Vincent Siveton</name>
<email>vsiveton@apache.org</email>
<organization>Apache Software Foundation</organization>
<roles>
<role>Java Developer</role>
</roles>
<timezone>-5</timezone>
</developer>
</developers>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<modules>
<module>framework</module>
<module>framework2</module>
</modules>
</project>

View File

@ -0,0 +1,13 @@
package org.apache.maven.plugin.site.test8;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@ -0,0 +1,12 @@
------
Configuring Site Plugin
------
Vincent Siveton
------
29 July 2005
------
Site Plugin MNG-661
Todo

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project name="Maven Site">
<bannerLeft>
<name>Maven Site</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
<bannerRight>
<src>http://maven.apache.org/images/maven-small.gif</src>
</bannerRight>
<body>
<links>
<item name="Maven 2" href="http://maven.apache.org/maven2/"/>
</links>
${parentProject}
${modules}
${reports}
</body>
</project>

View File

@ -0,0 +1,38 @@
package org.apache.maven.plugin.site.test8;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}