Bonjour bonjour braves gens, j´ai besoin de votre aide.
En effet je suis en train de decouvrir maven dans le cadre de mon stage, et j´ai comprit beaucoup de choses deja.
Mon probleme est que je n´arrive pas a utiliser dans mon projet des jars externes, mis en ligne avec archiva.
J´ai projetA(appelé "newTest") qui a besoin de projetB(appelé "WindowApp")
J´arrive a mettre des artefacts de projetB en ligne avec archiva et "mvn deploy", mais sous cette forme :
(j´ai remplacé mon nom de domaine par "localhost")
http://localhost:8080/archiva/reposi...1.0-SNAPSHOT/:
windowApp-1.0-20080317.122025-28.jar
windowApp-1.0-20080317.122025-28.jar.md5
windowApp-1.0-20080317.122025-28.jar.sha1
windowApp-1.0-20080317.122025-28.pom
windowApp-1.0-20080317.122025-28.pom.md5
windowApp-1.0-20080317.122025-28.pom.sha1
Et quand j´essaye de compiler ProjetA, il ne trouve pas l´artefact de ProjetB:
Maven cherche l´artifact : windowApp-1.0-SNAPSHOT.jar
Le fichier est present dans mon repository local (.m2/repository/) mais pas en ligne ou il n´y a que les artefacts avec comme nom, les noms de versions.(comme decrit juste au dessus )
Voici le fichier settings.xml:
Pom.xml du windowApp (projetB)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61 <settings 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/xsd/settings-1.0.0.xsd" > <localRepository> C:\Dokumente und Einstellungen\yma\.m2\repository </localRepository> <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>192.168.0.3</host> <port>8080</port> <id>defproxy</id> <nonProxyHosts>127.0.0.1|localhost|maven.ethalon.de</nonProxyHosts> </proxy> </proxies> <servers> <server> <id>snapshots</id> <username>admin</username> <password>password</password> </server> </servers> <mirrors> <!-- --> <mirror> <id>archiva.default</id> <url>http://localhost:8080/archiva/repository/internal</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> <profiles> <profile> <id>default</id> <activation> <activeByDefault>true</activeByDefault> </activation> <repositories> <repository> <id>internal</id> <url>http://localhost:8080/archiva/repository/internal</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>false</enabled></snapshots> </repository> <repository> <id>snapshots</id> <url>http://localhost:8080/archiva/repository/snapshots</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> </profile> </profiles> </settings>
Et le fichier pom.xml du projet newTest (projetA)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83 <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>yannick.app</groupId> <artifactId>windowApp</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> <name>windowApp</name> <url>http://maven.apache.org</url> <build> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-webdav</artifactId> <version>1.0-beta-2</version> </extension> </extensions> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <packageName>yannick.app</packageName> </manifest> <manifestEntries> <mode>development</mode> <url>${pom.url}</url> </manifestEntries> <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile> </archive> </configuration> </plugin> </plugins> </build> <repositories> <repository> <releases><enabled>false</enabled></releases> <snapshots /> <id>snapshots</id> <name>Archiva Managed Snapshot Repository</name> <url>http://localhost:8080/archiva/repository/snapshots</url> </repository> <repository> <releases /> <snapshots><enabled>false</enabled></snapshots> <id>internal</id> <name>Archiva Managed Internal Repository</name> <url>http://localhost:8080/archiva/repository/internal</url> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> <distributionManagement> <repository> <id>internal</id> <name>Archiva Managed Internal Repository</name> <url>dav:http://localhost:8080/archiva/repository/internal</url> </repository> <snapshotRepository> <id>snapshots</id> <name>Archiva Managed Snapshot Repository</name> <url>dav:http://localhost:8080/archiva/repository/snapshots</url> </snapshotRepository> </distributionManagement> </project>
Quand j´ai fait ma derniere compilation, j´ai supprimé le package du projetB de mon repository local, pour que maven aille chercher celui sur archiva. Voici le message d´erreur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62 <?xml version="1.0" encoding="UTF-8"?><project> <modelVersion>4.0.0</modelVersion> <groupId>yannick.test</groupId> <artifactId>newTest</artifactId> <name>newTest</name> <version>1.0-SNAPSHOT</version> <url>http://maven.apache.org</url> <build> <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-webdav</artifactId> <version>1.0-beta-2</version> </extension> </extensions> </build> <repositories> <repository> <releases> <enabled>false</enabled> </releases> <snapshots /> <id>snapshots</id> <name>Archiva Managed Snapshot Repository</name> <url>http://localhost:8080/archiva/repository/snapshots</url> </repository> <repository> <releases /> <snapshots> <enabled>false</enabled> </snapshots> <id>internal</id> <name>Archiva Managed Internal Repository</name> <url>http://localhost:8080/archiva/repository/internal</url> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>yannick.app</groupId> <artifactId>windowApp</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> <distributionManagement> <repository> <id>internal</id> <name>Archiva Managed Internal Repository</name> <url>dav:http://localhost:8080/archiva/repository/internal</url> </repository> <snapshotRepository> <id>snapshots</id> <name>Archiva Managed Snapshot Repository</name> <url>dav:http://localhost:8080/archiva/repository/snapshots</url> </snapshotRepository> </distributionManagement> </project>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
48
49
50
51
52
53
54
55
56
57
58
59 C:\Dokumente und Einstellungen\yma\IBM\rationalsdp7.0\workspace\newTest>mvn install [INFO] Scanning for projects... WAGON_VERSION: 1.0-beta-2 [INFO] ------------------------------------------------------------------------ [INFO] Building newTest [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. Downloading: http://localhost:8080/archiva/repository/snapshots/yannick/app/windowApp/1.0-SNAPSHOT/windowApp-1.0-SNAPSHOT.pom Downloading: http://localhost:8080/archiva/repository/snapshots/yannick/app/windowApp/1.0-SNAPSHOT/windowApp-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) yannick.app:windowApp:jar:1.0-SNAPSHOT Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=yannick.app -DartifactId=windowApp -Dve rsion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=yannick.app -DartifactId=windowApp -Dvers ion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId =[id] Path to dependency: 1) yannick.test:newTest:jar:1.0-SNAPSHOT 2) yannick.app:windowApp:jar:1.0-SNAPSHOT ---------- 1 required artifact is missing. for artifact: yannick.test:newTest:jar:1.0-SNAPSHOT from the specified remote repositories: central (http://repo1.maven.org/maven2), snapshots (http://localhost:8080/archiva/repository/snapshots), internal (http://localhost:8080/archiva/repository/internal) [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11 seconds [INFO] Finished at: Mon Mar 17 14:21:10 CET 2008 [INFO] Final Memory: 4M/7M [INFO] ------------------------------------------------------------------------ C:\Dokumente und Einstellungen\yma\IBM\rationalsdp7.0\workspace\newTest>
Donc en gros, pour resumer, mon projetB, deployé dans mon repository local, ca marche !
Et une fois qu´il n´est plus en local, et seulement sous archiva, je ne peux plus m´en servir.Est-ce normal que les noms de jars soient avec les numeros de version, et qu´il n´y ai aucun "windowApp-1.0-SNAPSHOT.jar " ? Je pense que si je pouvais gerer ca au niveau du deploy, une partie du probleme serait resolu. Ce fichier est present dans le repository local, mais pas sur archiva.
Si vous pouviez me filer quelques tuyaux, ca m´enleverai une enorme epine du pied.
Je vous remercie par avance, j´espere avoir donné les information qu´il faut.
Partager