Changeset 29524

Show
Ignore:
Timestamp:
01/22/08 14:52:32 (11 months ago)
Author:
bdelbosc
Message:

update getting started using maven 2.0.8 and the new archetype

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/nuxeo-book/trunk/src/docbook/getting-started/index.xml

    r28428 r29524  
    4646 
    4747        <listitem> 
    48           <para>Maven 2.0.8 (or later)</para> 
     48          <para>Maven 2.0.8 (or later, <emphasis>not Maven 2.0.7</emphasis>)</para> 
    4949        </listitem> 
    5050 
     
    5858          installation wizard</link>). You can also download a nightly build 
    5959          installer <link 
    60           xlink:href="http://www.nuxeo.org/static/snapshots/">here</link> but 
     60          xlink:href="http://svn.nuxeo.org/snapshots/">here</link> but 
    6161          keep in mind that this one may be broken, so don't erase your 
    6262          working setup with a nightly build: the result is not 
     
    7070    please refer to <xref linkend="dev-environment-installation" />, where you 
    7171    will find useful help.</para> 
     72 
    7273  </section> 
    7374 
    74   <section
     75  <section xml:id="dev-setup"
    7576    <title>Starting a new project</title> 
    7677 
    77     <section> 
    78       <title>Create the initial source of your project using the Nuxeo Maven 
    79       archetype</title> 
    80  
    81       <section xml:id="dev-setup"> 
     78      <section> 
    8279        <title>About Maven</title> 
    8380 
    8481        <para>Before starting, if for you <emphasis>mvn</emphasis> sounds like 
    85         an other more boring acronym to learn, you should read these few 
    86         lines, otherwise, you can skip it and go to the next step.</para> 
     82        an other more boring acronym to learn, you should read these few lines, 
     83        otherwise, you can skip it and go to the next step.</para> 
    8784 
    8885        <para>Maven is an IT project helper, that structures the development 
     
    180177        archetype introduction</link> for more information about 
    181178        archetypes.</para> 
    182       </section> 
    183  
    184       <section xml:id="archetypes-configuration-maven"> 
    185         <title>Maven settings</title> 
    186  
    187         <para><emphasis>We assume you have fulfilled the aforementioned 
    188         prerequisite.</emphasis></para> 
    189  
    190         <para>You need to setup Maven to access Nuxeo's repositories. This is 
    191         done by adding (or modifying) a Nuxeo profile in your 
    192         <filename>~/.m2/settings.xml</filename> file.</para> 
    193  
    194         <para><programlisting language="xml">&lt;settings&gt; 
    195  
    196   &lt;profiles&gt; 
    197     &lt;profile&gt; 
    198       &lt;id&gt;Nuxeo&lt;/id&gt; 
    199  
    200       &lt;properties&gt; 
    201         &lt;downloadSources&gt;true&lt;/downloadSources&gt; 
    202       &lt;/properties&gt; 
    203  
    204       &lt;repositories&gt; 
    205         &lt;repository&gt; 
    206           &lt;id&gt;central_proxy&lt;/id&gt; 
    207           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/central&lt;/url&gt; 
    208           &lt;snapshots&gt; 
    209             &lt;enabled&gt;false&lt;/enabled&gt; 
    210           &lt;/snapshots&gt; 
    211         &lt;/repository&gt; 
    212         &lt;repository&gt; 
    213           &lt;id&gt;external_snapshot&lt;/id&gt; 
    214           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/external_snapshot&lt;/url&gt; 
    215           &lt;releases&gt; 
    216             &lt;enabled&gt;false&lt;/enabled&gt; 
    217           &lt;/releases&gt; 
    218         &lt;/repository&gt; 
    219         &lt;repository&gt; 
    220           &lt;id&gt;nuxeo_release&lt;/id&gt; 
    221           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/nuxeo_release&lt;/url&gt; 
    222           &lt;snapshots&gt; 
    223             &lt;enabled&gt;false&lt;/enabled&gt; 
    224           &lt;/snapshots&gt; 
    225         &lt;/repository&gt; 
    226         &lt;repository&gt; 
    227           &lt;id&gt;nuxeo_snapshot&lt;/id&gt; 
    228           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/nuxeo_snapshot&lt;/url&gt; 
    229           &lt;releases&gt; 
    230             &lt;enabled&gt;false&lt;/enabled&gt; 
    231           &lt;/releases&gt; 
    232         &lt;/repository&gt; 
    233       &lt;/repositories&gt; 
    234       &lt;pluginRepositories&gt; 
    235         &lt;pluginRepository&gt; 
    236           &lt;id&gt;central_proxy&lt;/id&gt; 
    237           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/central&lt;/url&gt; 
    238           &lt;snapshots&gt; 
    239             &lt;enabled&gt;false&lt;/enabled&gt; 
    240           &lt;/snapshots&gt; 
    241         &lt;/pluginRepository&gt; 
    242         &lt;pluginRepository&gt; 
    243           &lt;id&gt;external_snapshot&lt;/id&gt; 
    244           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/external_snapshot&lt;/url&gt; 
    245           &lt;releases&gt; 
    246             &lt;enabled&gt;false&lt;/enabled&gt; 
    247           &lt;/releases&gt; 
    248         &lt;/pluginRepository&gt; 
    249         &lt;pluginRepository&gt; 
    250           &lt;id&gt;nuxeo_release&lt;/id&gt; 
    251           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/nuxeo_release&lt;/url&gt; 
    252           &lt;snapshots&gt; 
    253             &lt;enabled&gt;false&lt;/enabled&gt; 
    254           &lt;/snapshots&gt; 
    255         &lt;/pluginRepository&gt; 
    256         &lt;pluginRepository&gt; 
    257           &lt;id&gt;nuxeo_snapshot&lt;/id&gt; 
    258           &lt;url&gt;http://archiva.nuxeo.org/archiva/repository/nuxeo_snapshot&lt;/url&gt; 
    259           &lt;releases&gt; 
    260             &lt;enabled&gt;false&lt;/enabled&gt; 
    261           &lt;/releases&gt; 
    262         &lt;/pluginRepository&gt; 
    263       &lt;/pluginRepositories&gt; 
    264  
    265     &lt;/profile&gt; 
    266   &lt;/profiles&gt; 
    267  
    268   &lt;activeProfiles&gt; 
    269     &lt;activeProfile&gt;Nuxeo&lt;/activeProfile&gt; 
    270   &lt;/activeProfiles&gt; 
    271  
    272 &lt;/settings&gt;</programlisting> Note that the <varname>Nuxeo</varname> 
    273         profile is activated.</para> 
    274  
    275         <para>Due to the Maven <link 
    276         xlink:href="http://jira.codehaus.org/browse/MNG-3099">bug 
    277         MNG-3099</link> the <varname>Nuxeo</varname> profile will be used with 
    278         archetype plugin only with a small workaround. You must either specify 
    279         the remote repository (using -DremoteRepositories) or create a 
    280         <filename>dummy.xml</filename> POM file, with the following content: 
    281         <programlisting language="xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
    282 &lt;project&gt; 
    283 &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; 
    284 &lt;groupId&gt;com.example&lt;/groupId&gt; 
    285 &lt;artifactId&gt;MNG-2261-workaround&lt;/artifactId&gt; 
    286 &lt;packaging&gt;pom&lt;/packaging&gt; 
    287 &lt;version&gt;1&lt;/version&gt; 
    288 &lt;/project&gt;</programlisting></para> 
    289       </section> 
     179 
     180    </section> 
     181 
    290182 
    291183      <section xml:id="archetypes-nuxeo-simple"> 
     
    299191        <para>To create a project named <varname>my-project</varname> in the 
    300192        <varname>com.company.sandbox</varname> area: <programlisting 
    301         language="xml">mvn archetype:create -DartifactId=my-project -DgroupId=com.company.sandbox \ 
    302   -DarchetypeArtifactId=nuxeo-archetype-simple \ 
    303   -DarchetypeGroupId=org.nuxeo.archetypes \ 
    304   -DarchetypeVersion=5.1-SNAPSHOT \ 
    305   -f /path/to/dummy.xml</programlisting> or <programlisting language="xml">mvn archetype:create -DartifactId=my-project -DgroupId=com.company.sandbox \ 
    306   -DarchetypeArtifactId=nuxeo-archetype-simple \ 
    307   -DarchetypeGroupId=org.nuxeo.archetypes \ 
    308   -DarchetypeVersion=5.1-SNAPSHOT \ 
    309   -DremoteRepositories=http://archiva.nuxeo.org/archiva/repository/nuxeo_snapshot</programlisting></para> 
    310  
    311         <para>You can see there are five or six arguments you need to 
    312         supply:</para> 
     193        language="xml">mvn archetype:create -DartifactId=my-project \ 
     194    -DgroupId=com.company.sandbox  \ 
     195    -DarchetypeArtifactId=nuxeo-archetype-simple   \ 
     196    -DarchetypeGroupId=org.nuxeo.archetypes   \ 
     197    -DarchetypeVersion=5.1-SNAPSHOT \ 
     198    -DremoteRepositories=http://archiva.nuxeo.org/archiva/repository/nuxeo_snapshot,http://archiva.nuxeo.org/archiva/repository/nuxeo_release</programlisting></para> 
     199 
     200        <para>You can see there are six arguments you need to supply:</para> 
    313201 
    314202        <para><itemizedlist> 
    315203            <listitem> 
    316               <para><emphasis>artifactId</emphasis>: the name of your project, usually with '-' to 
    317               separate the words if there are many</para> 
    318             </listitem> 
    319  
    320             <listitem> 
    321               <para><emphasis>groupId</emphasis>: the domain name of your project. Usually the 
    322               package parent name of your classes.</para> 
     204              <para><emphasis>artifactId</emphasis>: the name of your project, 
     205              usually with '-' to separate the words if there are many.</para> 
     206            </listitem> 
     207 
     208            <listitem> 
     209              <para><emphasis>groupId</emphasis>: the domain name of your 
     210              project. Usually the package parent name of your classes, you 
     211              should use '.' to separate the words (the '-' is not supported 
     212              here).</para> 
    323213            </listitem> 
    324214 
     
    336226              <para><emphasis>archetypeVersion</emphasis>: the version of the 
    337227              archetype which is equivalent to the version of Nuxeo EP 
    338               (5.1-M2, 5.1-M3, 5.1.0, 5.1.2, 5.1-SNAPSHOT, ...).</para> 
    339             </listitem> 
    340  
    341             <listitem> 
    342               <para><emphasis>remoteRepositories</emphasis>: (optional) the 
    343               repository from which download the archetype. If specified, 
    344               there is no need of the dummy.xml file workaround.</para> 
    345             </listitem> 
    346           </itemizedlist><note> 
    347             <para>The <filename>-f /path/to/dummy.xml</filename> is the 
    348             temporary workaround for Maven <link 
    349             xlink:href="http://jira.codehaus.org/browse/MNG-3099">bug 
    350             MNG-3099</link> (see Maven settings above). If you know the remote 
    351             repository URL, use instead 
    352             <emphasis>-DremoteRepositories</emphasis></para> 
    353           </note></para> 
     228              (5.1-M2, 5.1-M3, 5.1.0, 5.1.2, 5.1.3, 5.1-SNAPSHOT, ...).</para> 
     229            </listitem> 
     230 
     231            <listitem> 
     232              <para><emphasis>remoteRepositories</emphasis>: the 
     233              repository from which download the archetype.</para> 
     234            </listitem> 
     235          </itemizedlist> 
     236        </para> 
    354237 
    355238        <para>You should have the following source layout: <programlisting> 
    356   my-project/ 
    357   |-- build.properties.sample 
    358   |-- build.xml 
    359   |-- pom.xml 
    360   `-- src 
    361       `-- main 
    362           |-- java 
    363           |   `-- com 
    364           |       `-- company 
    365           |           `-- sandbox 
    366           |               |-- SampleAction.java 
    367           |               |-- SampleActionBean.java 
    368           |               `-- SampleEventListener.java 
    369           `-- resources 
    370               |-- META-INF 
    371               |   |-- MANIFEST.MF 
    372               |   `-- ejb-jar.xml 
    373               |-- OSGI-INF 
    374               |   |-- actions-contrib.xml 
    375               |   |-- core-types-contrib.xml 
    376               |   |-- deployment-fragment.xml 
    377               |   |-- directories-contrib.xml 
    378               |   |-- ecm-types-contrib.xml 
    379               |   |-- event-listener-contrib.xml 
    380               |   |-- l10n 
    381               |   |   |-- messages_en.properties 
    382               |   |   `-- messages_fr.properties 
    383               |   |-- lifecycle-contrib.xml 
    384               |   `-- theme-contrib.xml 
    385               |-- directories 
    386               |   `-- sample_languages.csv 
    387               |-- nuxeo.war 
    388               |   `-- incl 
    389               |       `-- tabs 
    390               |           `-- sample_view.xhtml 
    391               |-- schemas 
    392               |   `-- sample.xsd 
    393               |-- seam.properties 
    394               `-- themes 
    395                   `-- nxthemes-setup.xml 
     239my-project 
     240|-- build.properties.sample 
     241|-- build.xml 
     242|-- pom.xml 
     243|-- settings.xml 
     244`-- src 
     245    `-- main 
     246        |-- java 
     247        |   `-- com 
     248        |       `-- company 
     249        |           `-- sandbox 
     250        |               |-- BookEventListener.java 
     251        |               |-- BookFileManagerPlugin.java 
     252        |               |-- BookISBNEventListener.java 
     253        |               |-- BookIntegerConverter.java 
     254        |               |-- BookIntegerValidator.java 
     255        |               |-- BookManager.java 
     256        |               |-- BookManagerBean.java 
     257        |               |-- BookResultsProvider.java 
     258        |               |-- BookTitleDescriptor.java 
     259        |               |-- BookTitleService.java 
     260        |               `-- BookTitleServiceImpl.java 
     261        `-- resources 
     262            |-- META-INF 
     263            |   |-- MANIFEST.MF 
     264            |   `-- ejb-jar.xml 
     265            |-- OSGI-INF 
     266            |   |-- actions-contrib.xml 
     267            |   |-- booktitle-contrib.xml 
     268            |   |-- booktitle-service-contrib.xml 
     269            |   |-- content-template-contrib.xml 
     270            |   |-- core-types-contrib.xml 
     271            |   |-- deployment-fragment.xml 
     272            |   |-- directories-contrib.xml 
     273            |   |-- event-listener-contrib.xml 
     274            |   |-- filemanager-contrib.xml 
     275            |   |-- l10n 
     276            |   |   |-- messages.properties 
     277            |   |   |-- messages_en.properties 
     278            |   |   `-- messages_fr.properties 
     279            |   |-- lifecycle-contrib.xml 
     280            |   |-- querymodel-contrib.xml 
     281            |   |-- resultsprovider-contrib.xml 
     282            |   |-- search-contrib.xml 
     283            |   |-- theme-contrib.xml 
     284            |   `-- ui-types-contrib.xml 
     285            |-- directories 
     286            |   `-- book_keywords.csv 
     287            |-- nuxeo.war 
     288            |   |-- bookwizard.xhtml 
     289            |   `-- incl 
     290            |       |-- book_listing_fragment.xhtml 
     291            |       |-- bookwizard_page1.xhtml 
     292            |       |-- bookwizard_page2.xhtml 
     293            |       |-- bookwizard_page3.xhtml 
     294            |       `-- tabs 
     295            |           |-- book_view.xhtml 
     296            |           `-- folder_books_view.xhtml 
     297            |-- schemas 
     298            |   `-- book.xsd 
     299            |-- seam.properties 
     300            `-- themes 
     301                `-- theme-book.xml 
    396302      </programlisting></para> 
    397  
    398         <para>You should create a <filename>build.properties</filename> file 
    399         on the base of the <filename>build.properties.sample</filename> so 
    400         that <varname>jboss.dir</varname> points to your jboss path. This will 
    401         be used to send the packaged file in the good directory at deployment 
    402         time. Note that when using the Nuxeo EP 5 installer, the JBOSS home 
    403         directory is the same as the Nuxeo EP 5 home directory.</para> 
    404       </section> 
     303    </section> 
     304 
     305    <section xml:id="archetypes-configuration-maven"> 
     306        <title>Maven and Ant settings</title> 
     307 
     308        <para>You need to setup Maven to access Nuxeo's repositories. This is 
     309        done by adding (or modifying) a Nuxeo profile in your 
     310        <filename>$HOME/.m2/settings.xml</filename> file. Your generated project contains 
     311        a <filename>settings.xml</filename> file example.</para> 
     312 
     313        <para>You should create a <filename>build.properties</filename> file on 
     314        the base of the <filename>build.properties.sample</filename> so that 
     315        <varname>jboss.dir</varname> points to your jboss path. This will be 
     316        used by <application>Ant</application> to send the packaged file in the 
     317        good directory at deployment time. Note that when using the Nuxeo EP 5 
     318        installer, the JBOSS home directory is the same as the Nuxeo EP 5 home 
     319        directory.</para> 
    405320    </section> 
    406321 
     
    432347 
    433348      <para>If you have set the <varname>downloadSources</varname> property in 
    434       your <filename>~/.m2/settings.xml</filename> you can navigate in the 
     349      your <filename>$HOME/.m2/settings.xml</filename> you can navigate in the 
    435350      wall Nuxeo EP sources.</para> 
    436351 
     
    448363    <section> 
    449364      <title>Running your custom project</title> 
    450  
    451365      <para>Now that you have created your new custom project, you would want 
    452366      to see what your (not so tough) work produced? As easy as one line of 
     
    463377 
    464378      <para>Try to log with Admin signature (Administrator/Administrator) and 
    465       to create a new document: if your sample project was correctly deployed, 
    466       you should now see a "Sample Document" new type.</para> 
     379      to create a new document: if your project was correctly deployed, 
     380      you should now see a "Book" document type.</para> 
    467381 
    468382      <para>Do you still find <command>mvn</command> as a boring command? 
     
    473387  <section> 
    474388    <title>Using Documentation</title> 
    475  
    476389    <para><itemizedlist> 
    477390        <listitem>