You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2007/03/24 19:20:22 UTC
svn commit: r522083 - in /db/torque/maven2-plugin/trunk/src/site: ./
site.xml xdoc/ xdoc/usage.xml
Author: tfischer
Date: Sat Mar 24 11:20:21 2007
New Revision: 522083
URL: http://svn.apache.org/viewvc?view=rev&rev=522083
Log:
Created a usage page for the maven 2 plugin
Added:
db/torque/maven2-plugin/trunk/src/site/
db/torque/maven2-plugin/trunk/src/site/site.xml
db/torque/maven2-plugin/trunk/src/site/xdoc/
db/torque/maven2-plugin/trunk/src/site/xdoc/usage.xml
Added: db/torque/maven2-plugin/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/db/torque/maven2-plugin/trunk/src/site/site.xml?view=auto&rev=522083
==============================================================================
--- db/torque/maven2-plugin/trunk/src/site/site.xml (added)
+++ db/torque/maven2-plugin/trunk/src/site/site.xml Sat Mar 24 11:20:21 2007
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<project>
+
+ <bannerLeft>
+ <name>Apache Software Foundation</name>
+ <src>http://db.apache.org/torque/images/db-logo-white.png</src>
+ <href>http://db.apache.org/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://db.apache.org/torque/images/torque-logo-new.png</src>
+ </bannerRight>
+
+ <body>
+ <links>
+ <item name="Apache" href="http://www.apache.org/" />
+ <item name="DB" href="http://db.apache.org/" />
+ <item name="Torque" href="http://db.apache.org/torque"/>
+ </links>
+
+ <menu name="Overview">
+ <item name="Goals" href="plugin-info.html"/>
+ <item name="Usage" href="usage.html"/>
+ </menu>
+
+ ${reports}
+
+ </body>
+</project>
\ No newline at end of file
Added: db/torque/maven2-plugin/trunk/src/site/xdoc/usage.xml
URL: http://svn.apache.org/viewvc/db/torque/maven2-plugin/trunk/src/site/xdoc/usage.xml?view=auto&rev=522083
==============================================================================
--- db/torque/maven2-plugin/trunk/src/site/xdoc/usage.xml (added)
+++ db/torque/maven2-plugin/trunk/src/site/xdoc/usage.xml Sat Mar 24 11:20:21 2007
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<document>
+
+ <properties>
+ <title>Maven Torque Plugin</title>
+ </properties>
+
+ <body>
+ <section name="Usage">
+ <p>
+ To use the Torque Maven 2 plugin in your project, you need to configure
+ it in the pom.xml of your project. Here is an example:
+ </p>
+
+<source><![CDATA[
+...
+<build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.db.torque</groupId>
+ <artifactId>torque-maven-plugin</artifactId>
+ <configuration>
+ <targetDatabase>mysql</targetDatabase>
+ <targetPackage>org.apache.torque.test</targetPackage>
+ <driver>org.gjt.mm.mysql.Driver</driver>
+ <url>jdbc:mysql://localhost:3306/bookstore</url>
+ <user>root</user>
+ <password></password>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>om</goal>
+ <goal>documentation</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <artifactId>mysql-connector-java</artifactId>
+ <groupId>mysql</groupId>
+ <version>3.1.12</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+</build>
+...
+]]></source>
+
+ </section>
+
+ <section name="Generating code">
+
+ <p>
+ In the example configuration above, the goals <code>om</code> and
+ <code>documentation</code> are specified. Therefore, the
+ om java classes and the html documentation of the table structure
+ will be generated in the "generate sources" phase. This phase will be
+ executed e.g. when running <code>mvn compile</code> or
+ <code>mvn package</code>.
+ </p>
+
+ <p>
+ The om classes are generated in two locations:
+ <ul>
+ <li>
+ The base classes (which should not be modified by the user)
+ are generated by default in the directory
+ <code>target/generated-sources/torque</code>.
+ They will be deleted if the command <code>mvn clean</code> is run.
+ </li>
+ <li>
+ The non-base classes (which can be modified by the user) will be
+ generated ba default in the directory
+ <code>src/main/generated-java</code>.
+ Once generated, they will not be overwritten and will also not be
+ deleted if <code>mvn clean</code> is run.
+ </li>
+ </ul>
+ Both paths will be added to the compile source path of maven 2,
+ so the jave files in these directories will be compiled along with the
+ other java source.
+ </p>
+
+ <p>
+ The documentation is generated per default in the directory
+ <code>target/generated-docs/torque</code>.
+ </p>
+
+ </section>
+
+ <section name="Talking to the database">
+
+ <p>
+ To allow the Torque maven 2 plugin to communicate with the database,
+ the correct database url, database user and password must be given in the
+ Torque Maven 2 plugin's configuration. Also, the correct database driver
+ must be added as a dependency of the plugin. See the example configuration
+ above how this is done.
+ </p>
+
+ <p>
+ For example, one can use the Torque Maven 2 plugin to create the tables
+ corresponding to the om classes. Usually, one does not want to do this
+ every time the project is compiled or built, so specifying these goals
+ in the pom.xml makes no sense. Instead, one can execute the command
+ </p>
+<source>
+mvn torque:sql torque:sqlExec
+</source>
+
+ <p>
+ in the project's home directory to generate the sql for creating the
+ database table and afterwards executing the sql.
+ </p>
+
+ </section>
+
+ </body>
+</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org