| <!DOCTYPE html> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <!-- No caching headers --> |
| <meta http-equiv="cache-control" content="no-cache"/> |
| <meta http-equiv="pragma" content="no-cache"/> |
| <meta http-equiv="expires" content="-1"/> |
| <meta name="keywords" content="JDO, Apache, Java, Data, Objects"/> |
| <meta name="description" content="Apache JDO - Java Data Objects"/> |
| |
| <title>JDO Meets Maven</title> |
| |
| <link rel="icon" type="image/png" href="https://apache.github.io/db-jdo-site/images/JDO_32x32.png"/> |
| |
| <!-- |
| Apache JDO Documentation Template |
| ================================== |
| This template derived various aspects from Apache Deltaspike template, the Apache ISIS template and the Datanucleus template. |
| This template uses |
| * Bootstrap v3.3.7 (https://getbootstrap.com/) for navbar. |
| * Asciidoctor "foundation" CSS |
| * Bootswatch "cosmo" theme for Bootstrap (https://bootswatch.com/cosmo). |
| * Bootstrap TOC plugin v0.4.1 (https://afeld.github.io/bootstrap-toc/) for the table of contents. |
| * jQuery (necessary for Bootstrap's JavaScript plugins) |
| * Font-Awesome for some icons used by Asciidoctor |
| NOTE: tried using Font-Awesome CSS hosted locally but then fails to work! |
| --> |
| <link href="css/bootswatch/3.3.7/bootstrap-cosmo.css" rel="stylesheet"/> |
| <link href="css/bootstrap-toc/0.4.1/bootstrap-toc.min.css" rel="stylesheet"/> |
| |
| <link href="css/asciidoctor/foundation.css" rel="stylesheet"/> |
| <link href="css/datanucleus_theme.css" rel="stylesheet"/> |
| <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> |
| <script src="js/bootstrap/3.3.7/bootstrap.min.js"></script> |
| <script src="js/bootstrap-toc/0.4.1/bootstrap-toc.min.js"></script> |
| |
| <!-- Coderay syntax formatter --> |
| <style type="text/css"> |
| /* Stylesheet for CodeRay to match GitHub theme | MIT License | http://foundation.zurb.com */ |
| /*pre.CodeRay {background-color:#f7f7f8;}*/ |
| .CodeRay .line-numbers{border-right:1px solid #d8d8d8;padding:0 0.5em 0 .25em} |
| .CodeRay span.line-numbers{display:inline-block;margin-right:.5em;color:rgba(0,0,0,.3)} |
| .CodeRay .line-numbers strong{color:rgba(0,0,0,.4)} |
| table.CodeRay{border-collapse:separate;border-spacing:0;margin-bottom:0;border:0;background:none} |
| table.CodeRay td{vertical-align: top;line-height:1.45} |
| table.CodeRay td.line-numbers{text-align:right} |
| table.CodeRay td.line-numbers>pre{padding:0;color:rgba(0,0,0,.3)} |
| table.CodeRay td.code{padding:0 0 0 .5em} |
| table.CodeRay td.code>pre{padding:0} |
| .CodeRay .debug{color:#fff !important;background:#000080 !important} |
| .CodeRay .annotation{color:#007} |
| .CodeRay .attribute-name{color:#000080} |
| .CodeRay .attribute-value{color:#700} |
| .CodeRay .binary{color:#509} |
| .CodeRay .comment{color:#998;font-style:italic} |
| .CodeRay .char{color:#04d} |
| .CodeRay .char .content{color:#04d} |
| .CodeRay .char .delimiter{color:#039} |
| .CodeRay .class{color:#458;font-weight:bold} |
| .CodeRay .complex{color:#a08} |
| .CodeRay .constant,.CodeRay .predefined-constant{color:#008080} |
| .CodeRay .color{color:#099} |
| .CodeRay .class-variable{color:#369} |
| .CodeRay .decorator{color:#b0b} |
| .CodeRay .definition{color:#099} |
| .CodeRay .delimiter{color:#000} |
| .CodeRay .doc{color:#970} |
| .CodeRay .doctype{color:#34b} |
| .CodeRay .doc-string{color:#d42} |
| .CodeRay .escape{color:#666} |
| .CodeRay .entity{color:#800} |
| .CodeRay .error{color:#808} |
| .CodeRay .exception{color:inherit} |
| .CodeRay .filename{color:#099} |
| .CodeRay .function{color:#900;font-weight:bold} |
| .CodeRay .global-variable{color:#008080} |
| .CodeRay .hex{color:#058} |
| .CodeRay .integer,.CodeRay .float{color:#099} |
| .CodeRay .include{color:#555} |
| .CodeRay .inline{color:#000} |
| .CodeRay .inline .inline{background:#ccc} |
| .CodeRay .inline .inline .inline{background:#bbb} |
| .CodeRay .inline .inline-delimiter{color:#d14} |
| .CodeRay .inline-delimiter{color:#d14} |
| .CodeRay .important{color:#555;font-weight:bold} |
| .CodeRay .interpreted{color:#b2b} |
| .CodeRay .instance-variable{color:#008080} |
| .CodeRay .label{color:#970} |
| .CodeRay .local-variable{color:#963} |
| .CodeRay .octal{color:#40e} |
| .CodeRay .predefined{color:#369} |
| .CodeRay .preprocessor{color:#579} |
| .CodeRay .pseudo-class{color:#555} |
| .CodeRay .directive{font-weight:bold} |
| .CodeRay .type{font-weight:bold} |
| .CodeRay .predefined-type{color:inherit} |
| .CodeRay .reserved,.CodeRay .keyword {color:#000;font-weight:bold} |
| .CodeRay .key{color:#808} |
| .CodeRay .key .delimiter{color:#606} |
| .CodeRay .key .char{color:#80f} |
| .CodeRay .value{color:#088} |
| .CodeRay .regexp .delimiter{color:#808} |
| .CodeRay .regexp .content{color:#808} |
| .CodeRay .regexp .modifier{color:#808} |
| .CodeRay .regexp .char{color:#d14} |
| .CodeRay .regexp .function{color:#404;font-weight:bold} |
| .CodeRay .string{color:#d20} |
| .CodeRay .string .string .string{background:#ffd0d0} |
| .CodeRay .string .content{color:#d14} |
| .CodeRay .string .char{color:#d14} |
| .CodeRay .string .delimiter{color:#d14} |
| .CodeRay .shell{color:#d14} |
| .CodeRay .shell .delimiter{color:#d14} |
| .CodeRay .symbol{color:#990073} |
| .CodeRay .symbol .content{color:#a60} |
| .CodeRay .symbol .delimiter{color:#630} |
| .CodeRay .tag{color:#008080} |
| .CodeRay .tag-special{color:#d70} |
| .CodeRay .variable{color:#036} |
| .CodeRay .insert{background:#afa} |
| .CodeRay .delete{background:#faa} |
| .CodeRay .change{color:#aaf;background:#007} |
| .CodeRay .head{color:#f8f;background:#505} |
| .CodeRay .insert .insert{color:#080} |
| .CodeRay .delete .delete{color:#800} |
| .CodeRay .change .change{color:#66f} |
| .CodeRay .head .head{color:#f4f} |
| </style> |
| </head> |
| <body data-spy="scroll" data-target="#toc"> |
| <!-- Navbar --> |
| <nav class="navbar navbar-default navbar-static-top"> |
| <div class="container"> |
| <div class="navbar-header"> |
| <!-- Three line menu button for use on mobile screens --> |
| <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <!-- 'style' added to align image with navbar. FIX THIS --> |
| <a class="navbar-brand" href="https://db.apache.org/jdo/"> |
| <img style="margin-top: -12px;" alt="Brand" src="images/JDO_44x44.png"/> |
| </a> |
| <!-- TODO Any way to abstract the version from Maven? --> |
| <a class="navbar-brand" href="index.html">Apache JDO</a> |
| </div> |
| <!-- Navbar that will collapse on mobile screens --> |
| <div id="navbar" class="navbar-collapse collapse"> |
| <ul class="nav navbar-nav"> |
| <li class="dropdown"> |
| |
| <!-- menu item General --> |
| |
| |
| <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">General<span class="caret"></span></a> |
| |
| <ul class="dropdown-menu"> |
| <li><a href="why_jdo.html">Why JDO?</a></li> |
| <li><a href="getting-started.html">Getting Started</a></li> |
| <li><a href="specifications.html">Specifications</a></li> |
| <li><a href="tck.html">TCK</a></li> |
| <li><a href="javadoc.html">API Javadoc</a></li> |
| <li role="separator" class="divider"></li> |
| <li><a href="jdo_v_jpa.html">JDO v JPA</a></li> |
| <li><a href="jdo_v_jpa_api.html">JDO v JPA : API</a></li> |
| <li><a href="jdo_v_jpa_orm.html">JDO v JPA : ORM</a></li> |
| <li role="separator" class="divider"></li> |
| <li><a href="license.html">License</a></li> |
| <li><a href="impls.html">Implementations</a></li> |
| <li><a href="jdo_3_0_overview.html">JDO 3.0 Overview</a></li> |
| <li><a href="references.html">References</a></li> |
| <li><a href="glossary.html">Glossary</a></li> |
| </ul> |
| </li> |
| |
| <!-- menu item API Usage --> |
| |
| <li class="dropdown"> |
| |
| <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">API Usage<span class="caret"></span></a> |
| |
| <ul class="dropdown-menu"> |
| <li><a href="jdohelper.html">JDO Helper</a></li> |
| <li><a href="pmf.html">PersistenceManagerFactory</a></li> |
| <li><a href="pm.html">PersistenceManager</a></li> |
| <li><a href="transactions.html">Transactions</a></li> |
| <li><a href="attach_detach.html">Attach-Detach</a></li> |
| <li><a href="fetchgroups.html">Fetch Groups</a></li> |
| <li><a href="state_transition.html">Object States</a></li> |
| <li><a href="object_retrieval.html">Object Retrieval</a></li> |
| <li><a href="exceptions.html">Exceptions</a></li> |
| <li role="separator" class="divider"></li> |
| <li><a href="guides-replication.html">Data Replication</a></li> |
| </ul> |
| </li> |
| |
| <!-- menu item Types & Metadata --> |
| |
| <li class="dropdown"> |
| |
| <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Types & Metadata<span class="caret"></span></a> |
| |
| <ul class="dropdown-menu"> |
| <li><a href="class_types.html">Types of Classes</a></li> |
| <li><a href="field_types.html">Types of Fields</a></li> |
| <li role="separator" class="divider"></li> |
| <!-- <li class="dropdown-header">Metadata</li> --> |
| <li><a href="metadata.html">MetaData</a></li> |
| <li><a href="annotations.html">Annotations</a></li> |
| <li><a href="jdo_dtd.html">jdo DTD/XSD</a></li> |
| <li><a href="orm_dtd.html">orm DTD/XSD</a></li> |
| <li><a href="jdoquery_dtd.html">jdoquery DTD/XSD</a></li> |
| <li><a href="jdoconfig_dtd.html">jdoconfig DTD/XSD</a></li> |
| <li role="separator" class="divider"></li> |
| <li><a href="enhancement.html">Bytecode Enhancement</a></li> |
| </ul> |
| </li> |
| |
| <!-- menu item Query --> |
| |
| <li class="dropdown"> |
| |
| <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Query<span class="caret"></span></a> |
| |
| <ul class="dropdown-menu"> |
| <li><a href="jdoql.html">JDOQL</a></li> |
| <li><a href="jdoql_result.html">Result</a></li> |
| <li><a href="jdoql_methods.html">Methods</a></li> |
| <li><a href="jdoql_quickref.pdf">Quick Ref PDF</a></li> |
| <li role="separator" class="divider"></li> |
| <li><a href="extents.html">Extents</a></li> |
| </ul> |
| </li> |
| |
| <!-- menu item Community --> |
| |
| <li class="dropdown"> |
| |
| <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Community<span class="caret"></span></a> |
| |
| <ul class="dropdown-menu"> |
| <li><a href="get-involved.html">Get Involved</a></li> |
| <li><a href="team-list.html">Project Team</a></li> |
| <li><a href="mail-lists.html">Mailing Lists</a></li> |
| <li><a href="faq.html">FAQ</a></li> |
| </ul> |
| </li> |
| |
| <!-- menu item Development --> |
| |
| <li class="dropdown"> |
| |
| <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Development<span class="caret"></span></a> |
| |
| <ul class="dropdown-menu"> |
| <li><a href="roadmap.html">RoadMap / TODO</a></li> |
| <li><a href="downloads.html">Downloads</a></li> |
| <li><a href="source-code.html">Source Code</a></li> |
| <li><a href="coding-standards.html">Coding Standards</a></li> |
| <li><a href="issuetracking.html">Issue Tracking</a></li> |
| </ul> |
| </li> |
| </ul> |
| <!-- 'style' added to fix height of input box. FIX THIS --> |
| <form class="navbar-form navbar-left" role="search" id="search-form" action="https://www.google.com/search" method="get" style="padding: 1px 15px;"> |
| <div class="form-group"> |
| <input name="sitesearch" value="db.apache.org/jdo" type="hidden"> |
| <input name="q" type="text" class="form-control" placeholder="Search" style="margin-top: 7px; padding: 1px; border-radius: 5px; height: 30px; vertical-align: middle;"> |
| </div> |
| </form> |
| </div> |
| </div> |
| </nav> |
| <div class="container"> |
| |
| <div class="row-fluid"> |
| <div class="col-sm-9"> |
| <!-- <div class="page-title"> |
| <h3>JDO Meets Maven<a id="JDO_Meets_Maven"></a></h3> |
| </div> |
| --> |
| <div id="doc-content"> |
| <div class="sect1"> |
| <h2 id="index">JDO Meets Maven<a id="JDO_Meets_Maven"></a></h2> |
| <div class="sectionbody"> |
| <div class="paragraph"> |
| <p>By <a href="mailto:andy@jpox.org">Andy Jefferson</a></p> |
| </div> |
| <div class="sect2"> |
| <h3 id="_background_maven_a_id_background_maven_a">Background - Maven<a id="Background_-_Maven"></a></h3> |
| <div class="paragraph"> |
| <p><a href="http://maven.apache.org">Maven</a> is a tool for managing and building |
| projects providing an alternative to the accepted |
| <a href="http://ant.apache.org">Ant</a> build process. Maven is almost totally |
| plugin-driven, and provides plugins for many common tasks (for example: |
| building EJB components such as WARs and EARs, generating documentation, |
| running unit tests) and related software (for example: |
| <a href="http://checkstyle.sf.net">Checkstyle</a>, <a href="http://pmd.sf.net">PMD</a>, |
| <a href="http://www.thecortex.net/clover">Clover</a>, |
| <a href="http://www.jcoverage.com">JCoverage</a>).</p> |
| </div> |
| <div class="paragraph"> |
| <p>Maven builds on top of the definition of a project. It formalises |
| project definitions such as dependencies (and hence classpaths), |
| versions, source repositories, mailing lists, etc. This project |
| definition provides placeholders for all of the typical metrics |
| important to a project. It formalises the location of the source tree |
| for a project and of the unit tests. This rigorous structure allows |
| Maven’s plugins to provide generalised functionality such as building |
| the source tree, running the unit tests, generating javadoc, code |
| analysis, etc.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Maven operates using the concept of <strong>goals</strong>. Each <strong>goal</strong> can have "pre" |
| and "post" goals. This structure allows for chaining of operations, with |
| one operation firing off another, and another to achieve some overall |
| end result.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="_integrating_jdo_with_maven_a_id_integrating_jdo_with_maven_a">Integrating JDO with Maven<a id="Integrating_JDO_with_Maven"></a></h3> |
| <div class="paragraph"> |
| <p>In developing a JDO system, the developer has many concerns - not least |
| the likes of object-relationship mapping - and should, as far as |
| possible, be spared the "administrative" burdens associated with |
| building the system. Maven’s formalization of the source tree structure |
| and chaining of actions helps achieve this objective by saving the |
| developer from having to explicitly define tasks like JDO class |
| bytecode-enhancement. Thus, rather than explicitly invoking a |
| bytecode-enhancement task in the system build, Maven is able to provide |
| this activity by way of a plugin, which could even be automatically |
| chained off the existing Java compilation task.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="_anatomy_of_a_maven_jdo_plugin_a_id_anatomy_of_a_maven_jdo_plugin_a">Anatomy of a Maven JDO plugin<a id="Anatomy_of_a_Maven_JDO_plugin"></a></h3> |
| <div class="paragraph"> |
| <p>A Maven plugin can use a variety of languages, however most commonly |
| utilises <a href="http://jakarta.apache.org/commons/jelly/">Jelly scripting |
| language</a>, at least for definition of the plugin’s goals. A Maven plugin |
| typically requires a minimum of 3 files …​</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><em>project.xml</em> (defining the dependencies of the plugin on other |
| software)</p> |
| </li> |
| <li> |
| <p><em>plugin.jelly</em> (providing the <strong>goals</strong> definition)</p> |
| </li> |
| <li> |
| <p><em>plugin.properties</em> (properties available for configuration)</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>Maven plugins can use a variety of other scripting and templating |
| utilities, however these are not currently required for the JDO plugins |
| implemented.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Plugins have now been developed for <a href="http://www.jpox.org">JPOX</a>, and |
| <a href="http://tjdo.sf.net">TJDO</a>, though can readily be developed for any JDO |
| implementation. The best way of understanding the process involved is by |
| analysing a Maven JDO plugin - in this case, the JPOX plugin. Here the |
| <em>plugin.jelly</em> file is as follows:</p> |
| </div> |
| <div class="literalblock"> |
| <div class="content"> |
| <pre><goal name="jpox" |
| description="Enhance classes for use with Java Persistent Objects (JPOX)" |
| prereqs="jpox:enhance"/> |
| |
| <goal name="jpox:init"> |
| ... snip ... code to generate jpoxClasspath and jpoxMetaDataFiles |
| </goal> |
| |
| <goal name="jpox:enhance" |
| description="Perform the enhancement of classes for use with JPOX" |
| prereqs="jpox:init"> |
| <echo>JDO-enhancing classes for Java Persistent Objects</echo> |
| |
| <ant:java dir="${maven.build.dest}" |
| classname="org.jpox.enhance.SunReferenceEnhancer" |
| failonerror="true" |
| fork="true"> |
| <classpath refid="jpoxClasspath"/> |
| <arg line="${jpoxMetaDataFiles}"/> |
| </ant:java> |
| |
| <echo>Classes are now JDO-enhanced for Java Persistent Objects</echo> |
| </goal></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>It can be seen that the plugin has several goals, the default one being |
| to run the enhance goal. Since this goal requires (as a prerequisite) |
| the running of the init goal, they are chained.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Some JDO implementations (for example JPOX, or Kodo) allow the |
| generation of the JDO database schema prior to running the JDO-enabled |
| application. This is catered for with additional <strong>goal(s)</strong>. For JPOX |
| again, this is handled as follows</p> |
| </div> |
| <div class="literalblock"> |
| <div class="content"> |
| <pre><goal name="jpox:schema-create" |
| prereqs="jpox:init"> |
| <echo>Creating tables for Persistence Capability</echo> |
| |
| <ant:java dir="${maven.build.dest}" |
| classname="org.jpox.SchemaTool" |
| failonerror="true" |
| fork="true"> |
| <classpath refid="jpoxClasspath"/> |
| <sysproperty key="database.driver" value="${maven.jpox.database.driver}"/> |
| <sysproperty key="database.url" value="${maven.jpox.database.url}"/> |
| <sysproperty key="database.user" value="${maven.jpox.database.user}"/> |
| <sysproperty key="database.password" value="${maven.jpox.database.password}"/> |
| <arg line="-create"/> |
| <arg line="${jpoxMetaDataFiles}"/> |
| </ant:java> |
| </goal> |
| |
| <goal name="jpox:schema-delete" |
| prereqs="jpox:init"> |
| <echo>Deleting tables for Persistence Capability</echo> |
| |
| <ant:java dir="${maven.build.dest}" |
| classname="org.jpox.SchemaTool" |
| failonerror="true" |
| fork="true"> |
| <classpath refid="jpoxClasspath"/> |
| <sysproperty key="database.driver" value="${maven.jpox.database.driver}"/> |
| <sysproperty key="database.url" value="${maven.jpox.database.url}"/> |
| <sysproperty key="database.user" value="${maven.jpox.database.user}"/> |
| <sysproperty key="database.password" value="${maven.jpox.database.password}"/> |
| <arg line="-delete"/> |
| <arg line="${jpoxMetaDataFiles}"/> |
| </ant:java> |
| </goal></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>Hence there are 2 additional <strong>goals</strong>, one for creating all tables |
| required by JPOX, and a second for deleting these tables. Clearly this |
| has more relevance to <strong>schema generation</strong> than for <strong>existing schemas</strong></p> |
| </div> |
| <div class="paragraph"> |
| <p>Where a JDO implementation allows a particular configuration operation, |
| a Maven plugin <strong>goal</strong> can be added to deliver this functionality to the |
| Maven user. As a result, individual implementations can add as many |
| goals as they wish to fulfil their users requirements.</p> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="_using_a_maven_jdo_plugin_a_id_using_a_maven_jdo_plugin_a">Using a Maven JDO plugin<a id="Using_a_Maven_JDO_plugin"></a></h3> |
| <div class="paragraph"> |
| <p>Using the JPOX Maven plugin as an example, the basic enhancement process |
| could be invoked as follows:</p> |
| </div> |
| <div class="literalblock"> |
| <div class="content"> |
| <pre>maven jpox:enhance</pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>The problem with this is that it burdens the developer with having to |
| explicitly invoke the enhancement process. As an alternative it is |
| possible to integrate bytecode enhancement as an automatic step chained |
| off the basic Java compilation process. This is achieved by including |
| the following in the project <em>maven.xml</em> file:</p> |
| </div> |
| <div class="literalblock"> |
| <div class="content"> |
| <pre><postGoal name="java:compile"> |
| <attainGoal name="jpox:enhance"/> |
| </postGoal></pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>So wherever the <strong>java:compile</strong> goal is called, as a postGoal it runs the |
| <strong>jpox:enhance</strong> goal, leaving the developer with JDO enabled classes |
| ready to run.</p> |
| </div> |
| <div class="paragraph"> |
| <p>Maven’s plugins can be made configurable using properties specified in |
| the <em>plugin.properties</em> file. For the JPOX plugin, the following |
| properties can be set</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p><strong>maven.jpox.jdo.fileset.dir</strong> : Directory containing the JDO MetaData |
| files</p> |
| </li> |
| <li> |
| <p><strong>maven.jpox.jdo.fileset.include</strong> : Fileset include path for JDO |
| MetaData files (default: <strong>*/</strong>.jdo)</p> |
| </li> |
| <li> |
| <p><strong>maven.jpox.jdo.fileset.exclude</strong> : Fileset exclude path for JDO |
| MetaData files</p> |
| </li> |
| <li> |
| <p><strong>maven.jpox.database.driver</strong> : Driver for use in connecting to |
| datastore</p> |
| </li> |
| <li> |
| <p><strong>maven.jpox.database.url</strong> : URL defining the datastore</p> |
| </li> |
| <li> |
| <p><strong>maven.jpox.database.user</strong> : Login name for the datastore</p> |
| </li> |
| <li> |
| <p><strong>maven.jpox.database.password</strong> : Password for the datastore</p> |
| </li> |
| </ul> |
| </div> |
| <div class="paragraph"> |
| <p>For example, the following properties could be included in the Maven |
| <em>project.properties</em> file</p> |
| </div> |
| <div class="literalblock"> |
| <div class="content"> |
| <pre>maven.jpox.jdo.fileset.dir=${basedir}/jdo |
| maven.jpox.jdo.fileset.include=**/*.jdo |
| maven.jpox.database.driver=com.mysql.jdbc.Driver |
| maven.jpox.database.url=jdbc:mysql://localhost/jpox |
| maven.jpox.database.user={my_username} |
| maven.jpox.database.password={my_password}</pre> |
| </div> |
| </div> |
| <div class="paragraph"> |
| <p>This would define the JDO MetaData files residing under the "jdo" |
| project directory, with names matching <strong>.jdo and would be used when all |
| JDO plugin *goals</strong> (such as <strong>enhance</strong>) are called. The 4 <strong>database</strong> |
| properties are used in the <strong>schema-create/schema-delete</strong> goals (as seen |
| in the <em>plugin.jelly</em> file earlier).</p> |
| </div> |
| <div class="paragraph"> |
| <p>Invocation of the JPOX schema-create optional goal could be achieved as |
| follows:</p> |
| </div> |
| <div class="literalblock"> |
| <div class="content"> |
| <pre>maven jpox:schema-create</pre> |
| </div> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="_conclusion_a_id_conclusion_a">Conclusion<a id="Conclusion"></a></h3> |
| <div class="paragraph"> |
| <p>This article has attempted to give a feel for both the operation of |
| Maven, and how to integrate JDO into a Maven project. The various Maven |
| JDO plugins can be downloaded as follows</p> |
| </div> |
| <div class="ulist"> |
| <ul> |
| <li> |
| <p>JPOX (1.1.8) - <a href="http://www.jpox.org/">Java Persistent Objects (JPOX) |
| project</a></p> |
| </li> |
| <li> |
| <p>TJDO (2.0-beta3) - <a href="http://www.ibiblio.org/maven/maven/plugins/">Ibiblio |
| site</a></p> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <div class="sect2"> |
| <h3 id="_about_the_author_a_id_about_the_author_a">About the author<a id="About_the_author"></a></h3> |
| <div class="paragraph"> |
| <p>Andy Jefferson is an independent software consultant who has been |
| working in the IT industry for more than 15 years, primarily in the |
| United Kingdom. He is an active participator in several OpenSource |
| projects, primarily JPOX, and Apache JDO, and a member of the JSR243 |
| (JDO2) Expert Group.</p> |
| </div> |
| <hr> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="col-sm-3"> |
| <nav id="toc" data-spy="affix" data-toggle="toc"></nav> |
| </div> |
| </div> |
| |
| </div> |
| |
| <footer style="color:#fff; background-color:#222222; padding: 5px;"> |
| <div class="container"> |
| <div class="row" style="margin-top:25px"> |
| <div class="col-sm" align="center"> |
| <a href="https://www.facebook.com/JavaDataObjects" class="externalLink" title="Facebook">Facebook</a> |
| | |
| <a href="https://twitter.com/JavaDataObjects" class="externalLink" title="Twitter">Twitter</a> |
| | |
| <a href="http://wiki.apache.org/jdo" class="externalLink" title="Wiki">Wiki</a> |
| | |
| <a href="http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10630" class="externalLink" title="Issue Tracker">Issue Tracker</a> |
| | |
| <a href="mail-lists.html" title="Mailing Lists">Mailing Lists</a> |
| | |
| <a href="api31/apidocs/index.html" title="Latest Javadocs">Latest Javadocs</a> |
| </div> |
| </div> |
| <p class="text-center" style="margin-top:16px">© 2005-2020 Apache Software Foundation. All Rights Reserved.</p> |
| </div> |
| </footer> |
| |
| </body> |
| </html> |