You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2009/02/03 01:57:28 UTC
svn commit: r740175 - in /maven/doxia/doxia/trunk/doxia-book: pom.xml
src/main/assembly/ src/main/assembly/jar.xml src/main/components/
src/main/components/components.xml
src/main/java/org/apache/maven/doxia/book/BookDoxiaCli.java
Author: vsiveton
Date: Tue Feb 3 00:57:28 2009
New Revision: 740175
URL: http://svn.apache.org/viewvc?rev=740175&view=rev
Log:
o fixed build to create a correct assembly
Added:
maven/doxia/doxia/trunk/doxia-book/src/main/assembly/
maven/doxia/doxia/trunk/doxia-book/src/main/assembly/jar.xml (with props)
maven/doxia/doxia/trunk/doxia-book/src/main/components/
maven/doxia/doxia/trunk/doxia-book/src/main/components/components.xml (with props)
Modified:
maven/doxia/doxia/trunk/doxia-book/pom.xml
maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/BookDoxiaCli.java
Modified: maven/doxia/doxia/trunk/doxia-book/pom.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/pom.xml?rev=740175&r1=740174&r2=740175&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/pom.xml (original)
+++ maven/doxia/doxia/trunk/doxia-book/pom.xml Tue Feb 3 00:57:28 2009
@@ -34,50 +34,43 @@
<description>A component to write books like user manuals and guides in any format supported by Doxia.</description>
<dependencies>
+ <!-- doxia core -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-xdoc</artifactId>
- <version>${projectVersion}</version>
+ <artifactId>doxia-sink-api</artifactId>
</dependency>
+
+ <!-- doxia modules ordered -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-xhtml</artifactId>
- <version>${projectVersion}</version>
+ <artifactId>doxia-module-apt</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-apt</artifactId>
- <version>${projectVersion}</version>
+ <artifactId>doxia-module-docbook-simple</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-itext</artifactId>
- <version>${projectVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-latex</artifactId>
- <version>${projectVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-module-docbook-simple</artifactId>
- <version>${projectVersion}</version>
+ <artifactId>doxia-module-xdoc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
- <artifactId>doxia-sink-api</artifactId>
+ <artifactId>doxia-module-xhtml</artifactId>
</dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.0</version>
- </dependency>
+ <!-- plexus -->
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
@@ -94,6 +87,13 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-cli</artifactId>
+ <version>1.5</version>
+ </dependency>
+
+ <!-- misc -->
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
<version>1.0</version>
</dependency>
@@ -138,15 +138,42 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-maven-plugin</artifactId>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/components/components.xml</descriptor>
+ <descriptor>target/generated-resources/plexus/META-INF/plexus/components.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>merge-descriptors</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
- <descriptorId>jar-with-dependencies</descriptorId>
+ <descriptors>
+ <descriptor>src/main/assembly/jar.xml</descriptor>
+ </descriptors>
<archive>
<manifest>
<mainClass>org.apache.maven.doxia.book.BookDoxiaCli</mainClass>
</manifest>
</archive>
</configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
Added: maven/doxia/doxia/trunk/doxia-book/src/main/assembly/jar.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/main/assembly/jar.xml?rev=740175&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/main/assembly/jar.xml (added)
+++ maven/doxia/doxia/trunk/doxia-book/src/main/assembly/jar.xml Tue Feb 3 00:57:28 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>jar-with-dependencies</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <dependencySets>
+ <dependencySet>
+ <unpack>true</unpack>
+ <scope>runtime</scope>
+ <excludes>
+ <exclude>junit:junit</exclude>
+ <exclude>org.apache.maven.doxia:doxia-book</exclude>
+ </excludes>
+ </dependencySet>
+ </dependencySets>
+ <fileSets>
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly>
\ No newline at end of file
Propchange: maven/doxia/doxia/trunk/doxia-book/src/main/assembly/jar.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/doxia/trunk/doxia-book/src/main/assembly/jar.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/doxia/doxia/trunk/doxia-book/src/main/components/components.xml
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/main/components/components.xml?rev=740175&view=auto
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/main/components/components.xml (added)
+++ maven/doxia/doxia/trunk/doxia-book/src/main/components/components.xml Tue Feb 3 00:57:28 2009
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<component-set>
+ <!-- Doxia core -->
+ <components>
+ <component>
+ <role>org.apache.maven.doxia.Doxia</role>
+ <implementation>org.apache.maven.doxia.DefaultDoxia</implementation>
+ <description>Simple implementation of the Doxia interface:
+ uses a ParserManager to lookup a parser.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.doxia.parser.manager.ParserManager</role>
+ <field-name>parserManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.macro.Macro</role>
+ <role-hint>echo</role-hint>
+ <implementation>org.apache.maven.doxia.macro.EchoMacro</implementation>
+ <description>A simple macro that prints out the key and value of some supplied
+ parameters.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.macro.manager.MacroManager</role>
+ <implementation>org.apache.maven.doxia.macro.manager.DefaultMacroManager</implementation>
+ <description>Default implementation of <code>MacroManager</code></description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.doxia.macro.Macro</role>
+ <field-name>macros</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.macro.Macro</role>
+ <role-hint>snippet</role-hint>
+ <implementation>org.apache.maven.doxia.macro.snippet.SnippetMacro</implementation>
+ <description>A macro that prints out the content of a file or a URL.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.macro.Macro</role>
+ <role-hint>swf</role-hint>
+ <implementation>org.apache.maven.doxia.macro.SwfMacro</implementation>
+ <description>Macro for embedding Flash (SWF) within Maven documentation.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.macro.Macro</role>
+ <role-hint>toc</role-hint>
+ <implementation>org.apache.maven.doxia.macro.toc.TocMacro</implementation>
+ <description>Macro to display a <code>Table Of Content</code> in a
+ given <code>Sink</code>.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.module.site.manager.SiteModuleManager</role>
+ <implementation>org.apache.maven.doxia.module.site.manager.DefaultSiteModuleManager</implementation>
+ <description>Simple implementation of the SiteModuleManager interface.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.doxia.module.site.SiteModule</role>
+ <field-name>siteModules</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.parser.manager.ParserManager</role>
+ <implementation>org.apache.maven.doxia.parser.manager.DefaultParserManager</implementation>
+ <description>Simple implementation of the
+ <code>ParserManager</code> interface.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.doxia.parser.Parser</role>
+ <field-name>parsers</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <!-- Doxia apt -->
+ <component>
+ <role>org.apache.maven.doxia.parser.Parser</role>
+ <role-hint>apt</role-hint>
+ <implementation>org.apache.maven.doxia.module.apt.AptParser</implementation>
+ <description>The APT parser.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.doxia.macro.manager.MacroManager</role>
+ <field-name>macroManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.sink.SinkFactory</role>
+ <role-hint>apt</role-hint>
+ <implementation>org.apache.maven.doxia.module.apt.AptSinkFactory</implementation>
+ <description>APT implementation of the Sink factory.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.module.site.SiteModule</role>
+ <role-hint>apt</role-hint>
+ <implementation>org.apache.maven.doxia.module.apt.AptSiteModule</implementation>
+ <description />
+ </component>
+
+ <!-- Doxia docbook -->
+ <component>
+ <role>org.apache.maven.doxia.parser.Parser</role>
+ <role-hint>docbook</role-hint>
+ <implementation>org.apache.maven.doxia.module.docbook.DocBookParser</implementation>
+ <description>Parse a <code>Docbook</code> document and emit events
+ into the specified doxia Sink.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.sink.SinkFactory</role>
+ <role-hint>docbook</role-hint>
+ <implementation>org.apache.maven.doxia.module.docbook.DocbookSinkFactory</implementation>
+ <description>Docbook implementation of the Sink factory.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.module.site.SiteModule</role>
+ <role-hint>docbook</role-hint>
+ <implementation>org.apache.maven.doxia.module.docbook.DocBookSiteModule</implementation>
+ <description />
+ </component>
+
+ <!-- Doxia itext -->
+ <component>
+ <role>org.apache.maven.doxia.sink.SinkFactory</role>
+ <role-hint>itext</role-hint>
+ <implementation>org.apache.maven.doxia.module.itext.ITextSinkFactory</implementation>
+ <description>IText implementation of the Sink factory.</description>
+ </component>
+
+ <!-- Doxia latex -->
+ <component>
+ <role>org.apache.maven.doxia.sink.SinkFactory</role>
+ <role-hint>latex</role-hint>
+ <implementation>org.apache.maven.doxia.module.latex.LatexSinkFactory</implementation>
+ <description>Latex implementation of the Sink factory.</description>
+ </component>
+
+ <!-- Doxia xdoc -->
+ <component>
+ <role>org.apache.maven.doxia.parser.Parser</role>
+ <role-hint>xdoc</role-hint>
+ <implementation>org.apache.maven.doxia.module.xdoc.XdocParser</implementation>
+ <description>Parse an xdoc model and emit events into the specified doxia Sink.</description>
+ <requirements>
+ <requirement>
+ <role>org.apache.maven.doxia.macro.manager.MacroManager</role>
+ <field-name>macroManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.sink.SinkFactory</role>
+ <role-hint>xdoc</role-hint>
+ <implementation>org.apache.maven.doxia.module.xdoc.XdocSinkFactory</implementation>
+ <description>Xdoc implementation of the Sink factory.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.module.site.SiteModule</role>
+ <role-hint>xdoc</role-hint>
+ <implementation>org.apache.maven.doxia.module.xdoc.XdocSiteModule</implementation>
+ <description />
+ </component>
+
+
+ <!-- Doxia xhtml -->
+ <component>
+ <role>org.apache.maven.doxia.parser.Parser</role>
+ <role-hint>xhtml</role-hint>
+ <implementation>org.apache.maven.doxia.module.xhtml.XhtmlParser</implementation>
+ <description>Parse an xhtml model and emit events into a Doxia Sink.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.sink.SinkFactory</role>
+ <role-hint>xhtml</role-hint>
+ <implementation>org.apache.maven.doxia.module.xhtml.XhtmlSinkFactory</implementation>
+ <description>Xhtml implementation of the Sink factory.</description>
+ </component>
+ <component>
+ <role>org.apache.maven.doxia.module.site.SiteModule</role>
+ <role-hint>xhtml</role-hint>
+ <implementation>org.apache.maven.doxia.module.xhtml.XhtmlSiteModule</implementation>
+ <description></description>
+ </component>
+
+ <!-- Plexus -->
+ <component>
+ <role>org.codehaus.plexus.i18n.I18N</role>
+ <implementation>org.codehaus.plexus.i18n.DefaultI18N</implementation>
+ </component>
+ </components>
+</component-set>
Propchange: maven/doxia/doxia/trunk/doxia-book/src/main/components/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/doxia/doxia/trunk/doxia-book/src/main/components/components.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/BookDoxiaCli.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/BookDoxiaCli.java?rev=740175&r1=740174&r2=740175&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/BookDoxiaCli.java (original)
+++ maven/doxia/doxia/trunk/doxia-book/src/main/java/org/apache/maven/doxia/book/BookDoxiaCli.java Tue Feb 3 00:57:28 2009
@@ -20,6 +20,7 @@
*/
import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.maven.doxia.book.model.BookModel;
@@ -47,7 +48,11 @@
public static void main( String[] args )
throws Exception
{
- new BookDoxiaCli().execute( args );
+ if ( args == null || args.length == 0 )
+ {
+ args = new String[] { "-h" };
+ }
+ System.exit( new BookDoxiaCli().execute( args ) );
}
/** {@inheritDoc} */
@@ -60,15 +65,15 @@
public Options buildCliOptions( Options options )
{
options.addOption( OptionBuilder.withLongOpt( "book-xml" ).hasArg().withDescription(
- "book xml file." )
+ "The full path of the Doxia book descriptor XML file" ).isRequired()
.create( 'b' ) );
options.addOption( OptionBuilder.withLongOpt( "content" ).hasArg().withDescription(
- "book content" )
+ "The full path of the Doxia book directory containing APT/XML files" ).isRequired()
.create( 'c' ) );
options.addOption( OptionBuilder.withLongOpt( "output" ).hasArg().withDescription(
- "output directory" )
+ "The full path of the wanted output directory" ).isRequired()
.create( 'o' ) );
return options;
@@ -82,18 +87,47 @@
BookDoxia doxia = (BookDoxia) plexus.lookup( BookDoxia.ROLE );
String bookXml = cli.getOptionValue( 'b' );
+ File bookXmlFile = new File( bookXml );
+ if ( !bookXmlFile.isFile() )
+ {
+ throw new IllegalArgumentException ( bookXmlFile + " is not a file!" );
+ }
String content = cli.getOptionValue( 'c' );
+ File contentFile = new File( content );
+ if ( !contentFile.isDirectory() )
+ {
+ throw new IllegalArgumentException ( contentFile + " is not a directory!" );
+ }
String output = cli.getOptionValue( 'o' );
+ File outputFile = new File( output );
+ if ( outputFile.exists() && !outputFile.isDirectory() )
+ {
+ throw new IllegalArgumentException ( outputFile + " is not a directory!" );
+ }
File book1 = new File( bookXml );
List files = FileUtils.getFiles( new File( content ), "**/*.apt, **/*.xml", "" );
+ if ( files.isEmpty() )
+ {
+ System.out.println( "No files found!" );
+ return;
+ }
BookModel book = doxia.loadBook( book1 );
doxia.renderBook( book, "xdoc", files, new File( output ) );
}
+ /** {@inheritDoc} */
+ public void displayHelp()
+ {
+ System.out.println();
+
+ HelpFormatter formatter = new HelpFormatter();
+
+ formatter.printHelp( "doxia-book [options] -b <arg> -c <arg> -o <arg>", "\nOptions:", buildDefaultCliOptions(), "\n" );
+ }
}