操作系统:openSUSE Leap 4.2
IDE:Eclipse Mars
安装JDK:打开JDK 1.8& Oracle JDK 1.6
我最近必须为现有系统添加一些新功能。我的环境如上所述 该系统有5个独立的项目,它们的根文件夹并排设置,并使用maven来管理构建周期。
部署环境的JRE版本是Oracle JDK1.6,所以我必须在实现新功能并使用JDK1.8成功测试之后在我的开发环境中降级它,尽管这五个项目的文件夹结构根据我认为的maven推荐没有安排。
当我将Installed JDK从1.8更改为1.6,尝试使用maven-jetty-plugin(jetty:run)运行系统时,我得到以下错误输出:
...
[DEBUG] =======================================================================
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.25:run (default-cli) > test-compile @ yingfan-cpm-webapp >>>
[DEBUG] Could not find metadata yingfan:yingfan-cpm-core:0.0.1-SNAPSHOT/maven-metadata.xml in local (/home/lfree/.m2.3.2.5/repository)
[DEBUG] Could not find metadata yingfan:yingfan-cpm-core:0.0.1-SNAPSHOT/maven-metadata.xml in local (/home/lfree/.m2.3.2.5/repository)
[WARNING] The POM for yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=12, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=10, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=3, ConflictResolver.conflictItemCount=11, DefaultDependencyCollector.collectTime=212, DefaultDependencyCollector.transformTime=5}
[DEBUG] yingfan:yingfan-cpm-webapp:war:0.0.1-SNAPSHOT
[DEBUG] yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT:compile
[DEBUG] com.lowagie:itext:jar:2.1.7:compile
[DEBUG] bouncycastle:bcmail-jdk14:jar:138:compile
[DEBUG] bouncycastle:bcprov-jdk14:jar:138:compile
[DEBUG] org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[DEBUG] org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[DEBUG] org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[DEBUG] org.json:json:jar:20160212:compile
[DEBUG] javax.servlet:jstl:jar:1.2:compile
[DEBUG] ant:ant:jar:1.6.5:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.121 s
[INFO] Finished at: 2016-04-15T18:52:09+08:00
[INFO] Final Memory: 10M/118M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project yingfan-cpm-webapp: Could not resolve dependencies for project yingfan:yingfan-cpm-webapp:war:0.0.1-SNAPSHOT: Could not find artifact yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project yingfan-cpm-webapp: Could not resolve dependencies for project yingfan:yingfan-cpm-webapp:war:0.0.1-SNAPSHOT: Could not find artifact yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(Life cycleDependencyResolver.java:220)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDepend encies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoE xecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
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.MojoExecutor.executeForkedExecutions(MojoExecuto r.java:364)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
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(LifecycleMod uleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleMod uleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.bui ld(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:1 20)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25 )
at java.lang.reflect.Method.invoke(Method.java:597)
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 yingfan:yingfan-cpm-webapp:war:0.0.1-SNAPSHOT: Could not find artifact yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDe pendenciesResolver.java:211)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(Life cycleDependencyResolver.java:195)
... 26 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(Default RepositorySystem.java:384)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDe pendenciesResolver.java:205)
... 27 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactReso lver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArt ifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(Default RepositorySystem.java:367)
... 28 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactReso lver.java:434)
... 30 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/DependencyResolutionException
使用JDK 1.8,输出如下:
</configuration>
[DEBUG] =======================================================================
[INFO]
[INFO] >>> maven-jetty-plugin:6.1.25:run (default-cli) > test-compile @ yingfan-cpm-webapp >>>
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=156, ConflictIdSorter.graphTime=1, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=76, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=10, ConflictResolver.conflictItemCount=138, DefaultDependencyCollector.collectTime=258, DefaultDependencyCollector.transformTime=14}
[DEBUG] yingfan:yingfan-cpm-webapp:war:0.0.1-SNAPSHOT
[DEBUG] yingfan:yingfan-cpm-core:jar:0.0.1-SNAPSHOT:compile
[DEBUG] org.springframework:spring-core:jar:3.2.5.RELEASE:compile
[DEBUG] org.springframework:spring-beans:jar:3.2.5.RELEASE:compile
[DEBUG] org.springframework:spring-context:jar:3.2.5.RELEASE:compile
[DEBUG] org.springframework:spring-aop:jar:3.2.5.RELEASE:compile
[DEBUG] org.springframework:spring-expression:jar:3.2.5.RELEASE:compile
[DEBUG] org.springframework:spring-web:jar:3.2.5.RELEASE:compile
[DEBUG] aopalliance:aopalliance:jar:1.0:compile
[DEBUG] org.springframework:spring-tx:jar:3.2.5.RELEASE:compile
[DEBUG] org.springframework:spring-orm:jar:3.2.5.RELEASE:compile
[DEBUG] org.springframework:spring-context-support:jar:3.2.5.RELEASE:compile
yingfan-cpm-webapp和yingfan-cpm-core是五个项目中的两个,所有项目都导入了我的eclipse工作区。
为什么使用JDK1.6,yingfan-cpm-web项目对yingfan-cpm-core项目的依赖性无法正确识别?
P.S。 JDK版本是这两种情况的唯一区别。
答案 0 :(得分:0)
[INFO] -------------------------------------------- ---------------------------- [INFO]建立失败 [INFO] ----------------------------------------------- -------------------------
如果您能提供BUILD FAILURE错误的详细信息,效果会更好。
这可能是因为将Java版本从8更改为6时无法编译某些类