Je suis un tutoriel pour Maven. J'ai un projet très simple avec quelques modules à l'intérieur. Sur le module pom, je souhaite faire référence à la version principale du groupe et au groupe de projets via $ {parent.groupid} et $ {parent.version}. Par conséquent, si je change d’aucune de ces options, changez-les mais j'obtiens le POM parent non résolvable: impossible de transférer l'erreur d'artefact
J'ai lu plusieurs questions "POM parent non résolvable:" ici à stackoverflow mais rien de ce que j'ai lu ne m'aide.
Ma structure de répertoire est la suivante:
tutorial_maven(dir)
--> pom.xml(file)
--> tutorial_maven_jar(dir)
--> pom.xml(file)
Je reçois l'erreur suivante:
Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: C:\Program Files (x86)\Apache-maven-3.0.4
Java version: 1.7.0_09, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_09\jre
Default locale: es_EC, platform encoding: UTF-8
OS name: "windows 7", version: "6.1", Arch: "AMD64", family: "windows"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from C:\Program Files (x86)\Apache-maven-3.0.4\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\fureta.DESARROLLO03\.m2\settings.xml
[WARNING] Command line option -npr is deprecated and will be removed in future Maven versions.
[DEBUG] Using local repository at C:\Users\fureta.DESARROLLO03\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Users\fureta.DESARROLLO03\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo.maven.Apache.org/maven2
Downloading: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tutorial_maven-${parent.version}.pom
[DEBUG] Writing resolution tracking file C:\Users\fureta.DESARROLLO03\.m2\repository\${parent\groupId}\tutorial_maven\${parent.version}\tutorial_maven-${parent.version}.pom.lastUpdated
[DEBUG] Extension realms for project org.felipe:tutorial_maven:pom:1.0-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Extension realms for project org.felipe:tutorial_maven_webapp:war:1.0-SNAPSHOT: (none)
[DEBUG] Looking up lifecyle mappings for packaging war from ClassRealm[plexus.core, parent: null]
[ERROR] The build could not read 1 project -> [Help 1]
org.Apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[WARNING] 'parent.relativePath' points at org.felipe:tutorial_maven instead of ${parent.groupId}:tutorial_maven, please verify your project structure @ line 3, column 13
[FATAL] Non-resolvable parent POM: Could not transfer artifact ${parent.groupId}:tutorial_maven:pom:${parent.version} from/to central (http://repo.maven.Apache.org/maven2): Illegal character in path at index 37: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tutorial_maven-${parent.version}.pom and 'parent.relativePath' points at wrong local POM @ line 3, column 13
at org.Apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.Java:363)
at org.Apache.maven.DefaultMaven.collectProjects(DefaultMaven.Java:636)
at org.Apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.Java:585)
at org.Apache.maven.DefaultMaven.doExecute(DefaultMaven.Java:234)
at org.Apache.maven.DefaultMaven.execute(DefaultMaven.Java:156)
at org.Apache.maven.cli.MavenCli.execute(MavenCli.Java:537)
at org.Apache.maven.cli.MavenCli.doMain(MavenCli.Java:196)
at org.Apache.maven.cli.MavenCli.main(MavenCli.Java:141)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.Java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.Java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.Java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.Java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.Java:47)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.Java:120)
[ERROR]
[ERROR] The project ${parent.groupId}:tutorial_maven_jar:${parent.version} (C:\Users\fureta.DESARROLLO03\IdeaProjects\tutorial_maven\tutorial_maven_jar\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not transfer artifact ${parent.groupId}:tutorial_maven:pom:${parent.version} from/to central (http://repo.maven.Apache.org/maven2): Illegal character in path at index 37: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tuto rial_maven-${parent.version}.pom and 'parent.relativePath' points at wrong local POM @ line 3, column 13 -> [Help 2]
org.Apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact ${parent.groupId}:tutorial_maven:pom:${parent.version} from/to central (http://repo.maven.Apache.org/maven2): Illegal character in path at index 37: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tuto rial_maven-${parent.version}.pom
at org.Apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.Java:159)
at org.Apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.Java:813)
at org.Apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.Java:664)
at org.Apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.Java:310)
at org.Apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.Java:232)
at org.Apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.Java:410)
at org.Apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.Java:379)
at org.Apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.Java:495)
at org.Apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.Java:379)
at org.Apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.Java:343)
at org.Apache.maven.DefaultMaven.collectProjects(DefaultMaven.Java:636)
at org.Apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.Java:585)
at org.Apache.maven.DefaultMaven.doExecute(DefaultMaven.Java:234)
at org.Apache.maven.DefaultMaven.execute(DefaultMaven.Java:156)
at org.Apache.maven.cli.MavenCli.execute(MavenCli.Java:537)
at org.Apache.maven.cli.MavenCli.doMain(MavenCli.Java:196)
at org.Apache.maven.cli.MavenCli.main(MavenCli.Java:141)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.Java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.Java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.Java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.Java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.Java:47)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.Java:120)
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact ${parent.groupId}:tutorial_maven:pom:${parent.version} from/to central (http://repo.maven.Apache.org/maven2): Illegal character in path at index 37: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tuto rial_maven-${parent.version}.pom
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.Java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.Java:216)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.Java:193)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.Java:286)
at org.Apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.Java:155)
... 30 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact ${parent.groupId}:tutorial_maven:pom:${parent.version} from/to central (http://repo.maven.Apache.org/maven2): Illegal character in path at index 37: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tutorial_maven-${parent.version}.pom
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.Java:951)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.Java:941)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.Java:669)
at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.Java:60)
at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1110)
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:603)
at Java.lang.Thread.run(Thread.Java:722)
Caused by: Java.lang.IllegalArgumentException: Illegal character in path at index 37: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tutorial_maven-${parent.version}.pom
at Java.net.URI.create(URI.Java:859)
at org.Apache.maven.wagon.providers.http.httpclient.client.methods.HttpGet.<init>(HttpGet.Java:69)
at org.Apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.Java:778)
at org.Apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.Java:116)
at org.Apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.Java:88)
at org.Apache.maven.wagon.StreamWagon.get(StreamWagon.Java:61)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.Java:601)
... 4 more
Caused by: Java.net.URISyntaxException: Illegal character in path at index 37: http://repo.maven.Apache.org/maven2/${parent/groupId}/tutorial_maven/${parent.version}/tutorial_maven-${parent.version}.pom
at Java.net.URI$Parser.fail(URI.Java:2829)
at Java.net.URI$Parser.checkChars(URI.Java:3002)
at Java.net.URI$Parser.parseHierarchical(URI.Java:3086)
at Java.net.URI$Parser.parse(URI.Java:3034)
at Java.net.URI.<init>(URI.Java:595)
at Java.net.URI.create(URI.Java:857)
... 10 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.Apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.Apache.org/confluence/display/MAVEN/UnresolvableModelException
J'ai lu les liens dans les aides 1 et 2, mais je n'ai rien trouvé qui puisse aider ... D'après ce que je peux comprendre des journaux, Maven recherche mon pom principal dans les dépôts Maven ...
Qu'est-ce que je rate?
Mon pom.xml principal
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.felipe</groupId>
<artifactId>tutorial_maven</artifactId>
<version>1.0-SNAPSHOT</version>
<modules>
<module>tutorial_maven_jar</module>
<module>tutorial_maven_webapp</module>
</modules>
<packaging>pom</packaging>
<name>tutorial_maven</name>
<url>http://maven.Apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--<log4j.version>1.2.17</log4j.version>-->
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
mon module pom.xml:
<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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>tutorial_maven</artifactId>
<groupId>${parent.groupId}</groupId>
<version>${parent.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>tutorial_maven_jar</artifactId>
<packaging>jar</packaging>
<name>tutorial_maven_jar</name>
<url>http://maven.Apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
<!--<optional>true</optional>-->
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies>
</project>
Cordialement, Felipe
On dirait que vous essayez à la fois d'hériter le groupId du parent et de spécifier simultanément le parent à l'aide d'un groupId hérité!
Dans l'enfant pom, utilisez quelque chose comme ceci:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.felipe</groupId>
<artifactId>tutorial_maven</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>tutorial_maven_jar</artifactId>
L'utilisation de propriétés telles que ${project.groupId}
ne fonctionnera pas ici. Si vous spécifiez le parent de cette manière, vous pouvez alors hériter de l'identifiant groupId et de la version dans le pom enfant. Par conséquent, il vous suffit de spécifier le paramètre artifactId dans le pom enfant.
Je suppose que la question est déjà répondu. Si la solution ci-dessus ne vous aide pas à résoudre le problème, vous pouvez utiliser ci-dessous pour résoudre le problème.
Le problème se produit si parfois les paramètres de votre utilisateur maven ne reflètent pas le fichier settings.xml correct.
Pour mettre à jour le fichier de paramètres, allez à Windows> Préférences> Maven> Paramètres utilisateur et mettez à jour le fichier settings.xml à l'emplacement correct.
Une fois que cela est fait pour reconstruire le projet, cela devrait résoudre le problème .. Merci.
J'ai eu le même problème. Fixé en ajoutant un pom.xml dans le dossier parent avec <modules>
répertorié.