项目xx-parent 下有多个模块 xx-a, xx-b
xx-a 依赖 xx-b, 但是我在pom.xml添加了依赖还是没用
在xx-b 里执行了mvn clean install, 安装到了本地库还是没用
最后我在xx-parent 下执行mvn clean install, 还是没用
报错:
Failed to execute goal on project woyin-admin: Could not resolve dependencies for project com.woyin:woyin-admin:war:1.0-SNAPSHOT: Failed to collect dependencies at com.woyin:woyin-comm🏺1.0-SNAPSHOT: Failed to read artifact descriptor for com.woyin:woyin-comm🏺1.0-SNAPSHOT: Could not find artifact com.woyin:Woyin-Parent:pom:1.0-SNAPSHOT -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project woyin-admin: Could not resolve dependencies for project com.woyin:woyin-admin:war:1.0-SNAPSHOT: Failed to collect dependencies at com.woyin:woyin-comm🏺1.0-SNAPSHOT at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221) at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127) at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:245) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.woyin:woyin-admin:war:1.0-SNAPSHOT: Failed to collect dependencies at com.woyin:woyin-comm🏺1.0-SNAPSHOT at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:180) at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195) ... 23 more Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at com.woyin:woyin-comm🏺1.0-SNAPSHOT at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:291) at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:316) at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:172) ... 24 more Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.woyin:woyin-comm🏺1.0-SNAPSHOT at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:329) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:198) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:535) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:519) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:254) ... 26 more Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact com.woyin:Woyin-Parent:pom:1.0-SNAPSHOT at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:177) at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:226) at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1000) at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:800) at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:329) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:320) ... 33 more Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact com.woyin:Woyin-Parent:pom:1.0-SNAPSHOT at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223) at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:173) ... 38 more Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.woyin:Woyin-Parent:pom:1.0-SNAPSHOT at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434) ... 41 more
<p>
<br>
</p>
<p>
<br>
</p>
你自己仔细检查试一下。
这种多模块依赖的maven工程,如果存在pom文件依赖,请在根目录下执行mvn命令。要不会找不到依赖的pom文件。
如果是在根目录下执行了,那还要继续找问题~~~
执行以下compile命令
写得不错,这里再补充一下,相互学习,共同进步。
Eclipse下Maven工程多模块继承和聚合创建(详解)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。