在编译打包某些项目中出现依赖检查错误,具体如下:
[ERROR] Failed to execute goal org.basepom.maven:duplicate-finder-maven-plugin:1.4.0:check (default) on project presto-vv: Found duplicate classes/resources! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.basepom.maven:duplicate-finder-maven-plugin:1.4.0:check (default) on project presto-vv: Found duplicate classes/resources!
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Found duplicate classes/resources!
at org.basepom.mojo.duplicatefinder.DuplicateFinderMojo.execute (DuplicateFinderMojo.java:419)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/MojoExecutionException
原因及解决方法
这种一般是开启了依赖检查,然后发现重复引入关联依赖的问题,如下:
[INFO] --- duplicate-finder-maven-plugin:1.4.0:check (default) @ presto-vv --- [INFO] Checking compile classpath [INFO] Checking runtime classpath [INFO] Checking test classpath [WARNING] Found duplicate (but equal) classes in [io.netty:netty-transport-native-unix-common:4.1.63.Final, io.netty:netty-transport-native-unix-common:4.1.63.Final:jar:linux-x86_64]: [WARNING] io.netty.channel.unix.Buffer [WARNING] io.netty.channel.unix.DatagramSocketAddress [WARNING] io.netty.channel.unix.DomainSocketAddress [WARNING] io.netty.channel.unix.DomainSocketChannel [WARNING] io.netty.channel.unix.DomainSocketChannelConfig [WARNING] io.netty.channel.unix.DomainSocketReadMode [WARNING] io.netty.channel.unix.Errors [WARNING] io.netty.channel.unix.ErrorsStaticallyReferencedJniMethods [WARNING] io.netty.channel.unix.FileDescriptor [WARNING] io.netty.channel.unix.IovArray [WARNING] io.netty.channel.unix.Limits [WARNING] io.netty.channel.unix.LimitsStaticallyReferencedJniMethods [WARNING] io.netty.channel.unix.NativeInetAddress [WARNING] io.netty.channel.unix.PeerCredentials [WARNING] io.netty.channel.unix.PreferredDirectByteBufAllocator [WARNING] io.netty.channel.unix.SegmentedDatagramPacket [WARNING] io.netty.channel.unix.ServerDomainSocketChannel [WARNING] io.netty.channel.unix.Socket [WARNING] io.netty.channel.unix.SocketWritableByteChannel [WARNING] io.netty.channel.unix.Unix [WARNING] io.netty.channel.unix.UnixChannel [WARNING] io.netty.channel.unix.UnixChannelOption [WARNING] io.netty.channel.unix.UnixChannelUtil [WARNING] Found duplicate (but equal) classes in [jakarta.annotation:jakarta.annotation-api:1.3.5, javax.annotation:javax.annotation-api:1.3.2]: [WARNING] javax.annotation.Generated [WARNING] javax.annotation.ManagedBean [WARNING] javax.annotation.PostConstruct [WARNING] javax.annotation.PreDestroy [WARNING] javax.annotation.Priority [WARNING] javax.annotation.Resource [WARNING] javax.annotation.Resources [WARNING] javax.annotation.security.DeclareRoles [WARNING] javax.annotation.security.DenyAll [WARNING] javax.annotation.security.PermitAll [WARNING] javax.annotation.security.RolesAllowed [WARNING] javax.annotation.security.RunAs [WARNING] javax.annotation.sql.DataSourceDefinition [WARNING] javax.annotation.sql.DataSourceDefinitions [WARNING] Found duplicate (but equal) classes in [jakarta.ws.rs:jakarta.ws.rs-api:2.1.6, javax.ws.rs:javax.ws.rs-api:2.1]: [WARNING] javax.ws.rs.ApplicationPath [WARNING] javax.ws.rs.BeanParam [WARNING] javax.ws.rs.ConstrainedTo [WARNING] javax.ws.rs.Consumes
解决方式就是关闭依赖检查(如果不是严格要求的话),该插件的解释参考:
maven-dependncy-plugin -> analyze-duplicate
关闭插件的参数是:skip
直接才当前pom或者parent pom中搜索:dependency:analyze-duplicate,然后添加skip参数并设置为true即可。



