在添加以下Hibernate Core依赖项后尝试构建我的Maven项目会导致以下警告和错误(1)
[INFO] Checking test classpath
[WARNING] Found duplicate and different classes in [javax.annotation:javax.annotation-api:1.2, javax.annotation:jsr250-api:1.0]:
[WARNING] javax.annotation.Generated
[WARNING] javax.annotation.PostConstruct
[WARNING] javax.annotation.PreDestroy
[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
[ERROR] Failed to execute goal org.basepom.maven:duplicate-finder-maven-plugin:1.2.1:check (default) on project school.server: Found duplicate classes/resources! -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.basepom.maven:duplicate-finder-maven-plugin:1.2.1:check (default) on project school.server: Found duplicate classes/resources!
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
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:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.plugin.MojoExecutionException: Found duplicate classes/resources!
at org.basepom.mojo.duplicatefinder.DuplicateFinderMojo.execute(DuplicateFinderMojo.java:424)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
这是引起问题的依赖性:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.1.Final</version>
</dependency>
我试图对javax.annotation
子依赖项(例如,类是重复的)进行依赖项排除,这是行不通的。
非常感谢您的帮助。
干杯!
答案 0 :(得分:0)
使用mvn dependency:tree
找出相关罐子进入的所有位置。确保在所有这些位置上都排除了它们。