maven 多模块项目, 依赖问题

plugin 发布于 2016/05/10 23:33
阅读 1K+
收藏 1

项目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




加载中
0
分流砥柱
分流砥柱

你自己仔细检查试一下。


0
大王来巡山
大王来巡山
未找到com.woyin:Woyin-Parent:pom:1.0-SNAPSHOT
plugin
plugin
我在这个parent下, 执行了mvn clean install , 然后再到之前的模块下执行mvn clean compile 还是没用
0
陈鹏烨
陈鹏烨

这种多模块依赖的maven工程,如果存在pom文件依赖,请在根目录下执行mvn命令。要不会找不到依赖的pom文件。

如果是在根目录下执行了,那还要继续找问题~~~



plugin
plugin
回复 @陈鹏烨 : 好吧。多谢了
陈鹏烨
陈鹏烨
回复 @plugin : 是不需要了。如果我说的问题都ok,那你只能继续找了,祝好运
plugin
plugin
回复 @陈鹏烨 : woyin-comm 是模块, pom.xml 里已经定义了<parent>就是Woyin-Parent吧。应该不需要再添加依赖了吧
陈鹏烨
陈鹏烨
回复 @plugin : 我看报错的堆栈信息,显示的编译 woyin-comm 的时候找不到 com.woyin:Woyin-Parent:pom:1.0-SNAPSHOT
陈鹏烨
陈鹏烨
回复 @plugin : woyin-comm 里面是否写了parent的依赖?
下一页
0
sunfeilong
sunfeilong

执行以下 compile命令

0
啵啵君--火星IT男
啵啵君--火星IT男

写得不错,这里再补充一下,相互学习,共同进步。

Eclipse下Maven工程多模块继承和聚合创建(详解)

返回顶部
顶部