私はmavenのチュートリアルに従っています。内部にいくつかのモジュールがある非常にシンプルなプロジェクトがあります。モジュールpomでは、$ {parent.groupid}および$ {parent.version}を介してメインのプロジェクトpomバージョンとグループを参照するため、これらのいずれかを変更する場合、子pomを探し回る必要はありません。それらを変更しますが、解決できない親POMを取得しています:アーティファクトエラーを転送できませんでした
私はここでstackoverflowでいくつかの「解決できない親POM:」の質問を読みましたが、読んだものは何も助けませんでした。
私のディレクトリ構造は次のとおりです。
tutorial_maven(dir)
--> pom.xml(file)
--> tutorial_maven_jar(dir)
--> pom.xml(file)
次のエラーが表示されます。
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
ヘルプ1とヘルプ2のリンクを読みましたが、役立つものは何も見つかりませんでした。私がログから理解できることから、MavenはMavenリポジトリで私のメインPOMを探しているということです...
私は何が欠けていますか?
私のメインの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">
<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>
私のモジュール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>
よろしく、フェリペ
親からgroupIdを継承すると同時に、継承されたgroupIdを使用して親を指定しようとしているようです!
子ポンムでは、次のようなものを使用します。
<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>
${project.groupId}
などのプロパティを使用しても機能しません。この方法で親を指定すると、子pomでgroupIdとバージョンを継承できます。したがって、子pomでartifactIdを指定するだけです。
質問にはすでに答えられていると思います。上記の解決策で問題を解決できない場合は、以下を使用して問題を解決できます。
この問題は、Mavenユーザー設定に正しいsettings.xmlファイルが反映されていない場合に発生します。
設定ファイルを更新するには、Windows> Preferences> Maven> User Settingsに移動し、settings.xmlを正しい場所に更新します。
これがプロジェクトを再構築したら、これらは問題を解決するはずです。ありがとう。
同じ問題がありました。 <modules>
がリストされた親フォルダーにpom.xmlを追加することで修正されました。
Nayanが言ったように、私の場合、Apache-mavenがC:\ Apache-mavenにインストールされ、settings.xmlがC:\ Apache-maven\conf\settings.xml
これがうまくいかない場合は、地元のレポジトリに行きます
私の場合はC:\ Users\<< "" "name。>>。m2 \
そして。lastUpdatedを検索して削除します
次に、mavenをビルドします