http://www.jouvinio.net/wiki/index.php?title=Configuration_Maven&feed=atom&action=historyConfiguration Maven - Historique des versions2024-03-29T08:08:45ZHistorique pour cette page sur le wikiMediaWiki 1.26.4http://www.jouvinio.net/wiki/index.php?title=Configuration_Maven&diff=18516&oldid=prevEtienne le 25 juin 2021 à 12:352021-06-25T12:35:28Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='fr'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Version précédente</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Version du 25 juin 2021 à 12:35</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l87" >Ligne 87 :</td>
<td colspan="2" class="diff-lineno">Ligne 87 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Dans le cadre de cet exemple, [[Nexus]] est hébergé sur la machine <code>192.168.1.32</code> derrière un serveur [[Apache]].</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Dans le cadre de cet exemple, [[Nexus]] est hébergé sur la machine <code>192.168.1.32</code> derrière un serveur [[Apache]].</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>=== [[File:System-Internet-Search-icon|link=]] Redirection ===</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>=== [[File:System-Internet-Search-icon<ins class="diffchange diffchange-inline">.png</ins>|link=]] Redirection ===</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>la première possibilité consiste à rediriger toutes les demandes sur le serveur <code>Nexus</code> en utilisant la configuration des miroirs. Dans la configuration suivante les accès sur tous les dépôts, valeur <code>*</code> pour la configuration <code>mirrorOf</code>, sont redirigé sur le dépôt <code>public</code> de l'instance <code>Nexus</code>.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>la première possibilité consiste à rediriger toutes les demandes sur le serveur <code>Nexus</code> en utilisant la configuration des miroirs. Dans la configuration suivante les accès sur tous les dépôts, valeur <code>*</code> pour la configuration <code>mirrorOf</code>, sont redirigé sur le dépôt <code>public</code> de l'instance <code>Nexus</code>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="xml"></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="xml"></div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l102" >Ligne 102 :</td>
<td colspan="2" class="diff-lineno">Ligne 102 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''Cependant''', ce type de configuration n'est pas recommandé car les projets peuvent définir leurs propres dépôts et il faut configurer un miroir au niveau de l'instance <code>Nexus</code>, et la placer dans le groupe <code>public</code>.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''Cependant''', ce type de configuration n'est pas recommandé car les projets peuvent définir leurs propres dépôts et il faut configurer un miroir au niveau de l'instance <code>Nexus</code>, et la placer dans le groupe <code>public</code>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>=== [[File:Configuration-icon.png|link=]] Configuration par dépôt <del class="diffchange diffchange-inline">=</del>===</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>=== [[File:Configuration-icon.png|link=]] Configuration par dépôt ===</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Le principe précédent peut être spécialisé pour configurer un miroir par dépôt en fonction de leur identifiant. La configuration suivante permet de spécifier un miroir pour le dépôt <code>central</code>, celui par défaut pour <code>Maven</code>, sur le dépôt <code>public</code> de l'instance <code>Nexus</code>.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Le principe précédent peut être spécialisé pour configurer un miroir par dépôt en fonction de leur identifiant. La configuration suivante permet de spécifier un miroir pour le dépôt <code>central</code>, celui par défaut pour <code>Maven</code>, sur le dépôt <code>public</code> de l'instance <code>Nexus</code>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="xml"></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><syntaxhighlight lang="xml"></div></td></tr>
</table>Etiennehttp://www.jouvinio.net/wiki/index.php?title=Configuration_Maven&diff=18502&oldid=prevEtienne le 15 janvier 2021 à 10:372021-01-15T10:37:55Z<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;' lang='fr'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Version précédente</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Version du 15 janvier 2021 à 10:37</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l167" >Ligne 167 :</td>
<td colspan="2" class="diff-lineno">Ligne 167 :</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     <activeProfile>nexus</activeProfile></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>     <activeProfile>nexus</activeProfile></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   </activeProfiles></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   </activeProfiles></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></syntaxhighlight></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">=== [[File:Icon ACL.png|link=]] Sécurité ===</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">Dans les exemples précédents, le miroir mis en place n'est pas sécurisé. Or il peut être nécessaire de se connecter pour y accéder et cela s'effectue à l'aide de la section <code>servers</code>. Il est possible de spécifier les identifiants de connexion pour chacun des serveurs. L'exemple suivant permet de donner un login / mot de passe pour le serveur avec l'identifiant <code>private-repo</code>, identifiant qui doit être le même que l'identifiant du miroir mis en place, ou du dépôt.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"><syntaxhighlight lang="xml"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  <servers></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    <!-- server</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    | Specifies the authentication information to use when connecting to a particular server, identified by</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    | a unique name within the system (referred to by the 'id' attribute below).</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    |</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    |      used together.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    |</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    <server></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <id>deploymentRepo</id></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <username>repouser</username></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <password>repopwd</password></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    </server></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    --></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;"></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    <!-- Another sample, using keys to authenticate.</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    <server></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <id>siteServer</id></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <privateKey>/path/to/private/key</privateKey></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <passphrase>optional; leave empty if not used.</passphrase></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    </server></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    --></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    <server></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <id>private-repo</id></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <username>my-login</username></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">      <password>my-password</password></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">    </server></ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins style="font-weight: bold; text-decoration: none;">  </servers></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div></syntaxhighlight></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>Etiennehttp://www.jouvinio.net/wiki/index.php?title=Configuration_Maven&diff=18501&oldid=prevEtienne le 15 janvier 2021 à 10:182021-01-15T10:18:49Z<p></p>
<a href="http://www.jouvinio.net/wiki/index.php?title=Configuration_Maven&diff=18501&oldid=11385">Voir les modifications</a>Etiennehttp://www.jouvinio.net/wiki/index.php?title=Configuration_Maven&diff=11385&oldid=prevEtienne le 28 novembre 2016 à 21:262016-11-28T21:26:45Z<p></p>
<p><b>Nouvelle page</b></p><div>La configuration de [[Maven]] s'effectue à travers les fichiers <code>settings.xml</code>. Cet article présente les options de configurations.<br />
<br />
<br />
== [[File:Hand-icon.png|link=]] Votre avis ==<br />
{|<br />
|{{#w4grb_rate:}}<br />
|style="padding: 0 0 1em 30px;"|{{#TwitterFBLike:|}}<br />
|}<br />
<br />
<br />
== [[File:Study icon.png|link=]] Etude ==<br />
La [https://maven.apache.org/settings.html documentation officielle] de Maven indique qu'il y a deux fichiers de configurations. Le principal <code>settings.xl</code> se trouve dans le répertoire <code>conf</code> de l'instance. Les configurations mises en place dans ce fichier vont s'appliquer à tous les utilisateurs.<br />
<br />
Chaque utilisateur peut également spécialiser la configuration, en plaçant un fichier <code>settings.xml</code> dans à l'emplacement <code>${user.home}/.m2/settings.xml</code>, où <code>${user.home}</code> correspond à l'emplacement "home" de l'utilisateur. Ces emplacements sont généralement sous <code>c:\Users\&lt;USER_NAME></code> pour Windows, ou <code>/home/&lt;USER_NAME></code> pour Linux.<br />
Les paramètres ne s'appliqueront qu'à l'utilisateur. Beaucoup recommande ce mode de configuration afin de préserver le fichier standard. Mais cela peut être problématique lorsque la machine est partagée par plusieurs utilisateurs, où une installation sur un serveur.<br />
<br />
Le contenu du fichier spécifique est identique au standard. COmme indiqué dans celui-ci, le plus simple est de le copier et de n'effectuer que les modifications nécessaires.<br />
<syntaxhighlight lang="xml"><br />
<!--<br />
| This is the configuration file for Maven. It can be specified at two levels:<br />
|<br />
| 1. User Level. This settings.xml file provides configuration for a single user,<br />
| and is normally provided in ${user.home}/.m2/settings.xml.<br />
|<br />
| NOTE: This location can be overridden with the CLI option:<br />
|<br />
| -s /path/to/user/settings.xml<br />
|<br />
| 2. Global Level. This settings.xml file provides configuration for all Maven<br />
| users on a machine (assuming they're all using the same Maven<br />
| installation). It's normally provided in<br />
| ${maven.home}/conf/settings.xml.<br />
|<br />
| NOTE: This location can be overridden with the CLI option:<br />
|<br />
| -gs /path/to/global/settings.xml<br />
|<br />
| The sections in this sample file are intended to give you a running start at<br />
| getting the most out of your Maven installation. Where appropriate, the default<br />
| values (values used when the setting is not specified) are provided.<br />
|<br />
|--><br />
</syntaxhighlight><br />
<br />
<br />
== [[File:Folder-icon.png|link=]] Emplacement dépôt ==<br />
Maven télécharge les librairies dans un dépôt local. Par défaut, cet emplacement se situe dans le répertoire <code>${user.home}/.m2/repository</code>. '''Par conséquent''', chaque utilisateur d'une plateforme entraîne la création d'un dépôt, qui peut grossir très rapidement. Dans le cas d'une installation sur un serveur d'intégration continue, par exemple, si les applications sont exécutées avec des comptes spécifiques, cela peut entraîner des redondances dans les paquets téléchargés. Mais si le répertoire est commun, il faut s'assurer que les permissions permettent à tous les comptes de créer des fichiers et répertoires.<br />
<br />
Il est donc recommander de spécifier ce paramétrage dans le fichier de configuration. Un exemple est fourni en commentaire dans le fichier standard.<br />
<syntaxhighlight lang="xml" highlight="4-9"><br />
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"<br />
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><br />
<!-- localRepository<br />
| The path to the local repository maven will use to store artifacts.<br />
|<br />
| Default: ${user.home}/.m2/repository<br />
<localRepository>/path/to/local/repo</localRepository><br />
--><br />
.<br />
.<br />
.<br />
</settings><br />
</syntaxhighlight><br />
<br />
Un exemple de configuration, sous Windows, peut être le suivant.<br />
<syntaxhighlight lang="xml" highlight="4-10"><br />
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"<br />
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><br />
<!-- localRepository<br />
| The path to the local repository maven will use to store artifacts.<br />
|<br />
| Default: ${user.home}/.m2/repository<br />
<localRepository>/path/to/local/repo</localRepository><br />
--><br />
<localRepository>C:/Apps/maven/repository</localRepository><br />
.<br />
.<br />
.<br />
</settings><br />
</syntaxhighlight><br />
<br />
<br />
== [[File:Folder inspection icon.png|link=]] Référencement Nexus ==<br />
=== Version 2.X ===<br />
Par défaut, Maven nécessite un accès internet afin de télécharger les librairies. Cependant les accès ne sont pas disponibles, cas de développement chez un client, et des gestionnaires de dépôt comme [[Nexus]], qui est pris en exemple ici.<br />
<br />
Afin d'utiliser le serveur [[Nexus]] mis en place, il faut ajouter un mirroir dans le fichier de configuration. Par défaut, toutes les demandes passeront par ce serveur. Au niveau du noeud <code>mirrors</code>, une configuration est ajoutée ainsi, comme décrit sur le site de [https://support.sonatype.com/entries/20943003-Configure-Maven-to-Download-from-Nexus Nexus] :<br />
* https://support.sonatype.com/entries/20943003-Configure-Maven-to-Download-from-Nexus<br />
* http://books.sonatype.com/nexus-book/reference/config-maven.html<br />
<br />
Dans le cadre de cet exemple, [[Nexus]] est hébergé sur la machine <code>192.168.1.32</code> derrière un serveur [[Apache]].<br />
Il faut configurer :<br />
* Un nouveau mirroir qui servira toutes les demandes;<br />
* Un profile avec une URL quelconque qui sera surchargée par le mirroir;<br />
* Activation du profile.<br />
<br />
Ainsi toutes les demandes seront dirigés vers le serveur [[Nexus]].<br />
<syntaxhighlight lang="xml"><br />
<mirrors><br />
<mirror><br />
<id>nexus</id><br />
<mirrorOf>*</mirrorOf><br />
<name>Local nexus.</name><br />
<url>http://192.168.1.32/nexus/content/groups/public</url><br />
</mirror><br />
</mirrors><br />
<br />
<profiles><br />
<profile><br />
<id>nexus</id><br />
<!-- Enable snapshots for the built in central repo to direct --><br />
<!-- all requests to nexus via the mirror --><br />
<repositories><br />
<repository><br />
<id>central</id><br />
<url>http://central</url><br />
<releases><enabled>true</enabled></releases><br />
<snapshots><enabled>true</enabled></snapshots><br />
</repository><br />
</repositories><br />
<pluginRepositories><br />
<pluginRepository><br />
<id>central</id><br />
<url>http://central</url><br />
<releases><enabled>true</enabled></releases><br />
<snapshots><enabled>true</enabled></snapshots><br />
</pluginRepository><br />
</pluginRepositories><br />
</profile><br />
</profiles><br />
<br />
<activeProfiles><br />
<!-- make the profile active all the time --><br />
<activeProfile>nexus</activeProfile><br />
</activeProfiles><br />
</syntaxhighlight><br />
<br />
=== Version 3.X ===<br />
Suite à l' [[Installation Nexus 3|installation version 3.X]] de Nexus, la configuration de Maven doit être modifiée car l'URL d'accès change. L'URL relatie devient <code>repository/public</code> et le fichier est modifiée ainsi.<br />
<syntaxhighlight lang="xml" gighlight="6-9"><br />
<mirrors><br />
<mirror><br />
<id>nexus</id><br />
<mirrorOf>*</mirrorOf><br />
<name>Local nexus.</name><br />
<!--<br />
<url>http://192.168.1.32/nexus/content/groups/public</url><br />
--><br />
<url>http://192.168.1.32/nexus/repository/public</url><br />
</mirror><br />
</mirrors><br />
<br />
<profiles><br />
<profile><br />
<id>nexus</id><br />
<!-- Enable snapshots for the built in central repo to direct --><br />
<!-- all requests to nexus via the mirror --><br />
<repositories><br />
<repository><br />
<id>central</id><br />
<url>http://central</url><br />
<releases><enabled>true</enabled></releases><br />
<snapshots><enabled>true</enabled></snapshots><br />
</repository><br />
</repositories><br />
<pluginRepositories><br />
<pluginRepository><br />
<id>central</id><br />
<url>http://central</url><br />
<releases><enabled>true</enabled></releases><br />
<snapshots><enabled>true</enabled></snapshots><br />
</pluginRepository><br />
</pluginRepositories><br />
</profile><br />
</profiles><br />
<br />
<activeProfiles><br />
<!-- make the profile active all the time --><br />
<activeProfile>nexus</activeProfile><br />
</activeProfiles><br />
</syntaxhighlight><br />
<br />
<br />
== [[File:Command-icon.png|link=]] Personnalisation ==<br />
Comme pour le fichier <code>settings.xml</code>, il est possible de positionner des variables d'environnement lors de l'exécution de Maven. Ainsi, chaque utilisateur d'une plateforme peut spécifier son propre environnement d'exécution, comme la gestion de la mémoire ou l'emplacement de la JDK. Dans les paragraphes suivants, les exemples sont sur une version 3.3.9.<br />
<br />
=== [[File:Windows-icon.png|link=]] Windows ===<br />
Pour une plateforme Windows, le script d'exécution <code>mvn.cmd</code> exécute les commandes suivantes.<br />
<syntaxhighlight lang="dos"><br />
@REM set %HOME% to equivalent of $HOME<br />
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")<br />
<br />
@REM Execute a user defined script before this one<br />
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre<br />
@REM check for pre script, once with legacy .bat ending and once with .cmd ending<br />
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"<br />
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"<br />
:skipRcPre<br />
</syntaxhighlight><br />
<br />
La première exécution permet de positionner la variable d'environnement <code>HOME</code> qui correspond au répertoire home de l'utilisateur. Pour l'utilisateur <code>user1</code>, cela sera généralement <code>c:/users/user1</code>.<br />
<br />
Puis, le fichier <code>mavenrc_pre.bat</code> est recherché dans ce répertoire, afin d'être exécuté si il existe. Il en est de même pour le fichier <code>mavenrc_pre.cmd</code>. Ainsi, il est possible de spécialiser le contexte d'exécution.<br />
<br />
Le script <code>mavenrc_pre.cmd</code> suivant permet de spécifier l'emplacement de la JDK ainsi que des options de mémoires.<br />
<syntaxhighlight lang="dos"><br />
set JAVA_HOME="C:\Apps\Java\jdk1.8.0_45"<br />
set MAVEN_OPTS=-Xms1024m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m<br />
</syntaxhighlight><br />
<br />
=== [[File:Logo Linux.png|link=]] Linux ===<br />
Pour une plateforme Linux, le script d'exécution <code>mvn</code> exécute les commandes suivantes.<br />
<syntaxhighlight lang="bash"><br />
if [ -z "$MAVEN_SKIP_RC" ] ; then<br />
<br />
if [ -f /etc/mavenrc ] ; then<br />
. /etc/mavenrc<br />
fi<br />
<br />
if [ -f "$HOME/.mavenrc" ] ; then<br />
. "$HOME/.mavenrc"<br />
fi<br />
<br />
fi<br />
</syntaxhighlight><br />
<br />
Si le fichier </code>/etc/mavenrc</code> existe, celui-ci est exécuté. Il en est de même avec le fichier <code>$HOME/.mavenrc</code>, où <code>$HOME</code> est l'emplacement du répertoire HOME de l'utilisateur.<br />
<br />
Le script <code>.mavenrc</code> suivant permet de spécifier l'emplacement de la JDK ainsi que des options de mémoires. '''A noter''' que ce script est mis en place sur une plateforme Windows, mais l'exécution est réalisée à travers <code>Git Bahs</code> qui utilise les commandes bash Linux.<br />
<syntaxhighlight lang="dos"><br />
export JAVA_HOME="c:/Apps/Java/jdk1.8.0_45"<br />
export MAVEN_OPTS="-Xms1024m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m"<br />
</syntaxhighlight><br />
<br />
=== [[File:Warning-icon.png|link=]] Emplacement Home ===<br />
Maven nécessite la variable d'environnement <code>M2_HOME</code> afin d'identifier l'emplacement des binaires. Cependant, il n'est pas nécessaire de la configurer en cas d'utilisation par défaut. En effet, celle-ci est renseignée lors du script d'exécution.<br />
<br />
Dans le cas de Windows, les commandes suivantes positionnent la valeur.<br />
<syntaxhighlight lang="dos"><br />
:stripMHome<br />
if not "_%M2_HOME:~-1%"=="_\" goto checkMCmd<br />
set "M2_HOME=%M2_HOME:~0,-1%"<br />
goto stripMHome<br />
</syntaxhighlight><br />
<br />
Dans le cas de "Linux", les commandes suivantes positionnent la valeur.<br />
<syntaxhighlight lang="bash"><br />
if [ -z "$M2_HOME" ] ; then<br />
## resolve links - $0 may be a link to maven's home<br />
PRG="$0"<br />
<br />
# need this for relative symlinks<br />
while [ -h "$PRG" ] ; do<br />
ls=`ls -ld "$PRG"`<br />
link=`expr "$ls" : '.*-> \(.*\)$'`<br />
if expr "$link" : '/.*' > /dev/null; then<br />
PRG="$link"<br />
else<br />
PRG="`dirname "$PRG"`/$link"<br />
fi<br />
done<br />
<br />
saveddir=`pwd`<br />
<br />
M2_HOME=`dirname "$PRG"`/..<br />
<br />
# make it fully qualified<br />
M2_HOME=`cd "$M2_HOME" && pwd`<br />
<br />
cd "$saveddir"<br />
# echo Using m2 at $M2_HOME<br />
fi<br />
</syntaxhighlight><br />
<br />
<br />
== [[File:Viewer icon.png|link=]] Voir aussi ==<br />
{{Modèle:OfficialManual|https://maven.apache.org/settings.html}}<br />
<br />
[[Category:Maven]]</div>Etienne