Configuration d'un repository distant dans le fichier settings.xml
Bonjour,
J'arrive à effectuer un "mvn deploy" lorsque je configure le repository distant dans le fichier pom.xml de mon projet (+ la partie <server> dans le fichier settings.xml).
Ce que je souhaite faire maintenant, c'est configurer le repository distant dans mon fichier "%MAVEN_HOME%/conf/settings.xml" au travers d'un profile et d'utiliser cette configuration lorsque je ferai un "mvn deploy" à partir de mon projet.
Voici l'erreur que j'obtiens en effectuant un "mvn deploy" :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-deploy-plugin:2.3
check that the following section of the pom.xml is present and correct:
<distributionManagement>
<!-- use the following if you re not using a snapshot version. -->
<repository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</repository>
<!-- use the following if you ARE using a snapshot version. -->
<snapshotRepository>
<id>repo</id>
<name>Repository Name</name>
<url>scp://host/path/to/repo</url>
</snapshotRepository>
</distributionManagement>
Cause: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Thu Jun 28 09:35:29 CEST 2007
[INFO] Final Memory: 7M/13M
[INFO] ------------------------------------------------------------------------ |
Je comprends l'erreur, alors j'ai fait un "mvn help:active-profiles" pour être certain que mon profile est pris en charge. Voici le résultat :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'help'.
WAGON_VERSION: 1.0-beta-2
[INFO] --------------------------------------------------------------------
[INFO] Building Affichage
[INFO] task-segment: [help:active-profiles] (aggregator-style)
[INFO] --------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project wallaby.utilitaire:Affichage:jar:1.0:
The following profiles are active:
- profile-perso (source: settings.xml)
[INFO] --------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] --------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jun 28 09:47:51 CEST 2007
[INFO] Final Memory: 3M/7M
[INFO] -------------------------------------------------------------------- |
Une copie de mon fichier pom.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>perso.utilitaire</groupId>
<artifactId>Affichage</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>Affichage</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
</build>
</project> |
Et une copie de mon fichier %MAVEN_HOME%/conf/settings.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
<settings>
<localRepository>C:/monRepositoryLocal</localRepository>
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>xxx</username>
<password>yyy</password>
<host>zzz</host>
<port>8080</port>
<nonProxyHosts>localhost,127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<id>monRepositoryDistant</id>
<username>xxx</username>
<password>yyy</password>
</server>
</servers>
<profiles>
<profile>
<id>profile-perso</id>
<repositories>
<repository>
<id>monRepositoryDistant</id>
<name>Mon repository distant</name>
<url>dav:http://localhost/monRepositoryDistant</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>profile-perso</activeProfile>
</activeProfiles>
</settings> |
J'ai également essayé la commande suivante pour m'assurer de la prise en charge du profile : "mvn -Pprofil-perso deploy"
Mais l'erreur reste la même.