doxia-maven-plugin-1.1.4/0000755000175000017500000000000011633152754015166 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/0000755000175000017500000000000011633152754015755 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/0000755000175000017500000000000011633152754016701 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/java/0000755000175000017500000000000011633152754017622 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/java/org/0000755000175000017500000000000011633152754020411 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/java/org/apache/0000755000175000017500000000000011633152754021632 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/java/org/apache/maven/0000755000175000017500000000000011633152754022740 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/java/org/apache/maven/doxia/0000755000175000017500000000000011633152754024044 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/java/org/apache/maven/doxia/plugin/0000755000175000017500000000000011633152754025342 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/main/java/org/apache/maven/doxia/plugin/Format.java0000644000175000017500000000246211142164566027440 0ustar twernertwernerpackage org.apache.maven.doxia.plugin; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ /** * A model for a supported output format. * * @author Trygve Laugstøl * @version $Id: Format.java 740545 2009-02-04 01:03:50Z vsiveton $ * @since 1.0 */ public class Format { /** A unique identifier for the format. */ private String id; /** * Returns the (unique) identifier of this format. * * @return the identifier. */ public String getId() { return id; } } doxia-maven-plugin-1.1.4/src/main/java/org/apache/maven/doxia/plugin/Book.java0000644000175000017500000000443511142164566027104 0ustar twernertwernerpackage org.apache.maven.doxia.plugin; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ import java.util.List; /** * A model for a Book. * * @author Trygve Laugstøl * @version $Id: Book.java 740545 2009-02-04 01:03:50Z vsiveton $ * @since 1.0 */ public class Book { /** Path to the book descriptor file. */ private String descriptor; /** The list of formats to produce. */ private List formats; /** The base directory of source files. */ private String directory; /** Files to include. */ private List includes; /** Files to exclude. */ private List excludes; /** * Returns the path to the book descriptor file. * * @return the book descriptor file. */ public String getDescriptor() { return descriptor; } /** * Returns the list of {@link Format}s to produce. * * @return the list of formats. */ public List getFormats() { return formats; } /** * Returns the base directory of source files. * * @return the base directory. */ public String getDirectory() { return directory; } /** * Returns the list of files to include. * * @return the list of files to include. */ public List getIncludes() { return includes; } /** * Returns the list of files to exclude. * * @return the list of files to exclude. */ public List getExcludes() { return excludes; } } doxia-maven-plugin-1.1.4/src/main/java/org/apache/maven/doxia/plugin/DoxiaRenderBooksMojo.java0000644000175000017500000002565611242734614032247 0ustar twernertwernerpackage org.apache.maven.doxia.plugin; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */ import org.apache.maven.doxia.book.BookDoxia; import org.apache.maven.doxia.book.BookDoxiaException; import org.apache.maven.doxia.book.InvalidBookDescriptorException; import org.apache.maven.doxia.book.model.BookModel; import org.apache.maven.doxia.book.services.validation.ValidationResult; import org.apache.maven.doxia.tools.SiteTool; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.StringUtils; import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.Locale; /** * A Mojo to create books in different output formats. * * @goal render-books * @author Trygve Laugstøl * @version $Id: DoxiaRenderBooksMojo.java 805701 2009-08-19 08:36:28Z ltheussl $ * @since 1.0 */ public class DoxiaRenderBooksMojo extends AbstractMojo { /** System EOL. */ private static final String LINE_SEPARATOR = System.getProperty( "line.separator" ); // ---------------------------------------------------------------------- // Mojo components // ---------------------------------------------------------------------- /** * BookDoxia component * * @component */ private BookDoxia bookDoxia; /** * SiteTool. * * @component */ protected SiteTool siteTool; // ---------------------------------------------------------------------- // Mojo parameters // ---------------------------------------------------------------------- /** * A list of books. * * @parameter * @required */ private List books; /** * Base directory of the project. * * @parameter default-value="${basedir}" */ private File basedir; /** * Directory containing the generated project docs. * * @parameter default-value="${project.build.directory}/generated-site" */ private File generatedDocs; /** * A comma separated list of locales supported by Maven. The first valid token will be the default Locale * for this instance of the Java Virtual Machine. * * @parameter default-value="${locales}" */ protected String locales; /** * Specifies the input encoding. * * @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}" */ private String inputEncoding; /** * Specifies the output encoding. * * @parameter expression="${outputEncoding}" default-value="${project.reporting.outputEncoding}" */ private String outputEncoding; // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- /** * {@inheritDoc} * * Executes the Mojo. */ public void execute() throws MojoExecutionException, MojoFailureException { for ( Iterator it = books.iterator(); it.hasNext(); ) { Book book = (Book) it.next(); // ---------------------------------------------------------------------- // Validate // ---------------------------------------------------------------------- if ( StringUtils.isEmpty( book.getDescriptor() ) ) { throw new MojoFailureException( "Invalid configuration: " + "The book is required to have a descriptor set." ); } if ( StringUtils.isEmpty( book.getDirectory() ) ) { throw new MojoFailureException( "Invalid configuration: " + "The book is required to have a directory set." ); } if ( book.getFormats() == null || book.getFormats().size() == 0 ) { throw new MojoFailureException( "Invalid configuration: " + "The book is required to have at least one format set." ); } // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- File descriptor = new File( basedir, book.getDescriptor() ); String includes = ""; if ( book.getIncludes() != null ) { for ( Iterator j = book.getIncludes().iterator(); j.hasNext(); ) { String include = (String) j.next(); includes += include + ","; } } else { includes = "**/*"; } String excludes = ""; if ( book.getExcludes() != null ) { for ( Iterator j = book.getExcludes().iterator(); j.hasNext(); ) { String exclude = (String) j.next(); excludes += exclude + ","; } } // ---------------------------------------------------------------------- // Find all the files to pass to the renderer. // ---------------------------------------------------------------------- if ( getLog().isDebugEnabled() ) { getLog().debug( "Locating files to include in the book:" ); getLog().debug( "Basedir: " + basedir ); getLog().debug( "Includes: " + includes ); getLog().debug( "Excludes: " + excludes ); } List files; try { files = FileUtils.getFiles( new File( basedir, book.getDirectory() ), includes, excludes ); } catch ( IOException e ) { throw new MojoExecutionException( "Error while looking for input files. " + "Basedir=" + basedir.getAbsolutePath() + ", " + "includes=" + includes + ", " + "excludes=" + excludes, e ); } // ----------------------------------------------------------------------- // Load the model // ----------------------------------------------------------------------- BookModel bookModel; try { bookModel = bookDoxia.loadBook( descriptor ); } catch ( InvalidBookDescriptorException e ) { throw new MojoFailureException( "Invalid book descriptor: " + LINE_SEPARATOR + formatResult( e.getValidationResult() ) ); } catch ( BookDoxiaException e ) { throw new MojoExecutionException( "Error while loading the book descriptor", e ); } // ----------------------------------------------------------------------- // Render the book in all the formats // ----------------------------------------------------------------------- List localesList = siteTool.getAvailableLocales( locales ); // Default is first in the list Locale defaultLocale = (Locale) localesList.get( 0 ); Locale.setDefault( defaultLocale ); for ( Iterator iterator = localesList.iterator(); iterator.hasNext(); ) { Locale locale = (Locale) iterator.next(); for ( Iterator j = book.getFormats().iterator(); j.hasNext(); ) { Format format = (Format) j.next(); File outputDirectory = new File( generatedDocs, format.getId() ); File directory = new File( outputDirectory + "/" + locale.toString(), bookModel.getId() ); if ( locale.equals( defaultLocale ) ) { directory = new File( outputDirectory, bookModel.getId() ); } try { bookDoxia.renderBook( bookModel, format.getId(), files, directory, locale, getInputEncoding(), getOutputEncoding() ); } catch ( BookDoxiaException e ) { throw new MojoExecutionException( "Error while generating book in format '" + format.getId() + "'.", e ); } } } } } /** * Gets the input files encoding. * * @return The input files encoding, never null. * @since 1.1 */ protected String getInputEncoding() { return ( inputEncoding == null ) ? ReaderFactory.ISO_8859_1 : inputEncoding; } /** * Gets the effective reporting output files encoding. * * @return The effective reporting output file encoding, never null. * @since 1.1 */ protected String getOutputEncoding() { return ( outputEncoding == null ) ? ReaderFactory.UTF_8 : outputEncoding; } /** * Returns a formatted message of a ValidationResult. * * @param result the ValidationResult to format. * @return the formatted result. */ private String formatResult( ValidationResult result ) { StringBuffer buffer = new StringBuffer(); if ( result.getErrors().size() > 0 ) { buffer.append( "Validation errors:" ); for ( Iterator it = result.getErrors().iterator(); it.hasNext(); ) { String error = (String) it.next(); buffer.append( LINE_SEPARATOR ).append( " " ).append( error ); } } if ( result.getWarnings().size() > 0 ) { buffer.append( "Validation warnings:" ); for ( Iterator it = result.getWarnings().iterator(); it.hasNext(); ) { String error = (String) it.next(); buffer.append( LINE_SEPARATOR ).append( " " ).append( error ); } } return buffer.toString(); } } doxia-maven-plugin-1.1.4/src/site/0000755000175000017500000000000011633152754016721 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/site/site.xml0000644000175000017500000000263511237301120020374 0ustar twernertwerner doxia-maven-plugin-1.1.4/src/site/apt/0000755000175000017500000000000011633152754017505 5ustar twernertwernerdoxia-maven-plugin-1.1.4/src/site/apt/usage.apt.vm0000644000175000017500000000246711237300613021736 0ustar twernertwerner ----- Usage ----- Lukas Theussl ----- Usage Below is a sample pom.xml illustrate how to use it. +------------------------------------------------------ org.apache.maven.doxia doxia-maven-plugin ${project.version} pre-site render-books src/books/example-book src/books/example-book.xml latex xdoc pdf rtf +------------------------------------------------------ See also the sample given on the main Doxia {{{http://maven.apache.org/doxia/book/index.html}site}}. doxia-maven-plugin-1.1.4/src/site/apt/index.apt0000644000175000017500000000647111237301120021311 0ustar twernertwerner ----- Doxia Maven Plugin ----- Lukas Theussl ----- ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Introduction Doxia allows you to write books like user manuals and guides in any format supported by Doxia. Combined with the Doxia Book Maven you are able to include the manuals directly in your generated site with links to the off-line friendly formats like XDoc, PDF, RTF and LaTeX. * Goals Overview The Doxia Maven Plugin has one goal: * {{{./render-books-mojo.html}doxia:render-books}} to create books in different output formats. First you need a simple book descriptor which is used to specify the layout of your book, i.e. the ordering of the sections and the names for the chapters. See {{{http://maven.apache.org/doxia/book/index.html}The Book Descriptor Reference}} for a reference to the descriptor. * Usage General instructions on how to use the Doxia Maven Plugin can be found on the {{{./usage.html}usage page}}. Some more specific use cases are described in the examples given below. Last but not least, users occasionally contribute additional examples, tips or errata to the {{{http://docs.codehaus.org/display/MAVENUSER/PDF+Plugin}plugin's wiki page}}. In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel free to contact the {{{./mail-lists.html}user mailing list}}. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the {{{./mail-lists.html}mail archive}}. If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our {{{./issue-tracking.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our {{{./source-repository.html}source repository}} and will find supplementary information in the {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. * Examples An Xdoc output example which has been rendered into this site can be viewed {{{http://maven.apache.org/doxia/doxia-example-book/index.html}here}}. doxia-maven-plugin-1.1.4/pom.xml0000644000175000017500000001471311470562366016514 0ustar twernertwerner 4.0.0 org.apache.maven.doxia doxia 1.1.4 ../pom.xml doxia-maven-plugin maven-plugin Doxia :: Maven Plugin A Maven plugin for Doxia. 2.0.2 org.apache.maven maven-plugin-api 2.0 ${project.groupId} doxia-book ${projectVersion} ${project.groupId} doxia-core ${projectVersion} ${project.groupId} doxia-logging-api ${projectVersion} org.apache.maven.doxia doxia-module-apt ${projectVersion} org.apache.maven.doxia doxia-module-docbook-simple ${projectVersion} org.apache.maven.doxia doxia-module-itext ${projectVersion} org.apache.maven.doxia doxia-module-latex ${projectVersion} org.apache.maven.doxia doxia-module-xdoc ${projectVersion} org.apache.maven.doxia doxia-module-xhtml ${projectVersion} org.apache.maven.doxia doxia-decoration-model 1.1.2 org.codehaus.plexus plexus-utils org.apache.maven.shared maven-doxia-tools 1.0.1 org.apache.maven.doxia doxia-decoration-model org.apache.maven.plugins maven-plugin-plugin 2.5.1 org.apache.maven.plugins maven-shade-plugin 1.2.2 org.apache.maven.plugins maven-shade-plugin package shade ${project.build.finalName} false true org.apache.maven.doxia:doxia-sink-api org.apache.maven.doxia:doxia-logging-api org.codehaus.mojo clirr-maven-plugin 1.1 org/apache/maven/doxia/logging/** org/apache/maven/doxia/sink/** org/codehaus/doxia/sink/** org.apache.maven.plugins maven-plugin-plugin generated-helpmojo helpmojo org.apache.maven.plugins maven-plugin-plugin 2.5.1