Search code examples
javaeclipsemavenjettymaven-jetty-plugin

Maven-jetty-plugin can't resolve project dependency when I changed JRE version from 1.8 to 1.6


OS: openSUSE Leap 4.2
IDE: Eclipse Mars JDK Installed: Open JDK 1.8 & Oracle JDK 1.6

I have to add some new feature to an existed system recently. My environment is as above.
This system have 5 separate projects with their root folder setting side by side, and using maven to manage the build cycle.

The JRE version of the deploy-environment is Oracle JDK1.6, so I have to downgrade it in my develop env after the new feature have been implemented and successfully tested with JDK1.8, though the folder structure of the five projects were not arranged according to maven recommendation I think.

When I changed Installed JDK from 1.8 to 1.6, trying to run the system with maven-jetty-plugin(jetty:run), I got the following error output:

...
[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

With JDK 1.8, the output is like this:

</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 and yingfan-cpm-core are two of the five projects all of which imported to my eclipse workspace.
Why with JDK1.6, the dependence of yingfan-cpm-web project to yingfan-cpm-core project can't be recognized correctly?

P.S. JDK version is the only difference of these two circumstances.


Solution

  • [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------

    The better if you can provide the detail of BUILD FAILURE error.

    This could be because some of your classes cannot be compiled when change Java version from 8 to 6