背景
IDEA新建modul,在pom文件引入了2个HBase的依赖,如下,然后打包的时候报错了,怀疑是依赖冲突了。
pom.xml:
<dependencies>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>2.0.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>
</dependencies>
错误信息:
Failure to find org.glassfish:javax.el:pom:3.0.1-b06-SNAPSHOT in https://repository.apache.org/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b06-SNAPSHOT is missing, no dependency information available
The POM for org.glassfish:javax.el:jar:3.0.1-b06-SNAPSHOT is missing, no dependency information available
Failure to find org.glassfish:javax.el:pom:3.0.1-b07-SNAPSHOT in https://repository.apache.org/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b07-SNAPSHOT is missing, no dependency information available
The POM for org.glassfish:javax.el:jar:3.0.1-b07-SNAPSHOT is missing, no dependency information available
Failure to find org.glassfish:javax.el:pom:3.0.1-b08-SNAPSHOT in https://repository.apache.org/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b08-SNAPSHOT is missing, no dependency information available
The POM for org.glassfish:javax.el:jar:3.0.1-b08-SNAPSHOT is missing, no dependency information available
Failure to find org.glassfish:javax.el:pom:3.0.1-b11-SNAPSHOT in https://repository.apache.org/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b11-SNAPSHOT is missing, no dependency information available
The POM for org.glassfish:javax.el:jar:3.0.1-b11-SNAPSHOT is missing, no dependency information available
解决方案
① IDEA打开终端输入命令:mvn dependency:tree,找到冲突jar包
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b06-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b07-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b08-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.glassfish:javax.el:jar:3.0.1-b11-SNAPSHOT is missing, no dependency information available
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ hbase0111 ---
[INFO] com.atguigu.hbase:hbase0111:jar:1.0-SNAPSHOT
[INFO] +- org.apache.hbase:hbase-server:jar:2.0.5:compile
[INFO] | +- org.apache.hbase.thirdparty:hbase-shaded-protobuf:jar:2.1.0:compile
[INFO] | +- org.apache.hbase.thirdparty:hbase-shaded-netty:jar:2.1.0:compile
[INFO] | +- org.apache.hbase.thirdparty:hbase-shaded-miscellaneous:jar:2.1.0:compile
[INFO] | +- org.apache.hbase:hbase-common:jar:2.0.5:compile
[INFO] | | \- com.github.stephenc.findbugs:findbugs-annotations:jar:1.3.9-1:compile
[INFO] | +- org.apache.hbase:hbase-http:jar:2.0.5:compile
[INFO] | | +- org.eclipse.jetty:jetty-util:jar:9.3.19.v20170502:compile
[INFO] | | +- org.eclipse.jetty:jetty-util-ajax:jar:9.3.19.v20170502:compile
[INFO] | | +- org.eclipse.jetty:jetty-http:jar:9.3.19.v20170502:compile
[INFO] | | +- org.eclipse.jetty:jetty-security:jar:9.3.19.v20170502:compile
[INFO] | | +- org.glassfish.jersey.core:jersey-server:jar:2.25.1:compile
[INFO] | | | +- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile
[INFO] | | | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile
[INFO] | | | | \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
[INFO] | | | +- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile
[INFO] | | | +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.25.1:compile
[INFO] | | | +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] | | | +- org.glassfish.hk2:hk2-api:jar:2.5.0-b32:compile
[INFO] | | | | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b32:compile
[INFO] | | | | \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b32:compile
[INFO] | | | +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32:compile
[INFO] | | | +- org.glassfish.hk2:hk2-locator:jar:2.5.0-b32:compile
[INFO] | | | | \- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] | | | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | | \- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.25.1:compile
[INFO] | +- org.apache.hbase:hbase-protocol:jar:2.0.5:compile
[INFO] | +- org.apache.hbase:hbase-protocol-shaded:jar:2.0.5:compile
[INFO] | +- org.apache.hbase:hbase-procedure:jar:2.0.5:compile
[INFO] | | \- org.apache.hbase:hbase-common:jar:tests:2.0.5:compile
[INFO] | +- org.apache.hbase:hbase-zookeeper:jar:2.0.5:compile
[INFO] | +- org.apache.hbase:hbase-replication:jar:2.0.5:compile
[INFO] | +- org.apache.hbase:hbase-metrics-api:jar:2.0.5:compile
[INFO] | +- org.apache.hbase:hbase-metrics:jar:2.0.5:compile
[INFO] | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | +- org.apache.hbase:hbase-hadoop-compat:jar:2.0.5:compile
[INFO] | +- org.apache.hbase:hbase-hadoop2-compat:jar:2.0.5:compile
[INFO] | +- org.eclipse.jetty:jetty-server:jar:9.3.19.v20170502:compile
[INFO] | | \- org.eclipse.jetty:jetty-io:jar:9.3.19.v20170502:compile
[INFO] | +- org.eclipse.jetty:jetty-servlet:jar:9.3.19.v20170502:compile
[INFO] | +- org.eclipse.jetty:jetty-webapp:jar:9.3.19.v20170502:compile
[INFO] | | \- org.eclipse.jetty:jetty-xml:jar:9.3.19.v20170502:compile
[INFO] | +- org.glassfish.web:javax.servlet.jsp:jar:2.3.2:compile
[INFO] | | +- org.glassfish:javax.el:jar:3.0.1-b12:compile (version selected from constraint [3.0.0,))
[INFO] | | \- javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:compile
[INFO] | +- org.codehaus.jettison:jettison:jar:1.3.8:compile
[INFO] | +- io.dropwizard.metrics:metrics-core:jar:3.2.1:compile
[INFO] | +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
[INFO] | +- commons-io:commons-io:jar:2.5:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.6:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] | +- org.apache.commons:commons-math3:jar:3.6.1:compile
[INFO] | +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] | +- log4j:log4j:jar:1.2.17:compile
[INFO] | +- org.apache.zookeeper:zookeeper:jar:3.4.10:compile
[INFO] | +- org.jamon:jamon-runtime:jar:2.4.1:compile
[INFO] | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
[INFO] | +- org.apache.htrace:htrace-core4:jar:4.2.0-incubating:compile
[INFO] | +- org.apache.htrace:htrace-core:jar:3.2.0-incubating:compile
[INFO] | +- com.lmax:disruptor:jar:3.3.6:compile
[INFO] | +- org.apache.commons:commons-crypto:jar:1.0.0:compile
[INFO] | +- org.apache.hadoop:hadoop-distcp:jar:2.7.7:compile
[INFO] | +- org.apache.hadoop:hadoop-common:jar:2.7.7:compile
[INFO] | | +- com.google.guava:guava:jar:11.0.2:compile
[INFO] | | +- commons-cli:commons-cli:jar:1.2:compile
[INFO] | | +- xmlenc:xmlenc:jar:0.52:compile
[INFO] | | +- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO] | | +- commons-net:commons-net:jar:3.1:compile
[INFO] | | +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO] | | +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] | | +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] | | +- org.mortbay.jetty:jetty-sslengine:jar:6.1.26:compile
[INFO] | | +- com.sun.jersey:jersey-json:jar:1.9:compile
[INFO] | | | +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] | | | +- org.codehaus.jackson:jackson-jaxrs:jar:1.8.3:compile
[INFO] | | | \- org.codehaus.jackson:jackson-xc:jar:1.8.3:compile
[INFO] | | +- com.sun.jersey:jersey-server:jar:1.9:compile
[INFO] | | | \- asm:asm:jar:3.1:compile
[INFO] | | +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | | +- net.java.dev.jets3t:jets3t:jar:0.9.0:compile
[INFO] | | | +- org.apache.httpcomponents:httpcore:jar:4.1.2:compile
[INFO] | | | \- com.jamesmurty.utils:java-xmlbuilder:jar:0.4:compile
[INFO] | | +- commons-lang:commons-lang:jar:2.6:compile
[INFO] | | +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] | | | +- commons-digester:commons-digester:jar:1.8:compile
[INFO] | | | \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] | | +- org.apache.avro:avro:jar:1.7.4:compile
[INFO] | | | +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] | | | \- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
[INFO] | | +- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] | | +- com.jcraft:jsch:jar:0.1.54:compile
[INFO] | | +- org.apache.curator:curator-client:jar:2.7.1:compile
[INFO] | | +- org.apache.curator:curator-recipes:jar:2.7.1:compile
[INFO] | | \- org.apache.commons:commons-compress:jar:1.4.1:compile
[INFO] | | \- org.tukaani:xz:jar:1.0:compile
[INFO] | +- org.apache.hadoop:hadoop-auth:jar:2.7.7:compile
[INFO] | | +- org.apache.httpcomponents:httpclient:jar:4.2.5:compile
[INFO] | | +- org.apache.directory.server:apacheds-kerberos-codec:jar:2.0.0-M15:compile
[INFO] | | | +- org.apache.directory.server:apacheds-i18n:jar:2.0.0-M15:compile
[INFO] | | | +- org.apache.directory.api:api-asn1-api:jar:1.0.0-M20:compile
[INFO] | | | \- org.apache.directory.api:api-util:jar:1.0.0-M20:compile
[INFO] | | \- org.apache.curator:curator-framework:jar:2.7.1:compile
[INFO] | +- org.apache.hadoop:hadoop-annotations:jar:2.7.7:compile
[INFO] | | \- jdk.tools:jdk.tools:jar:1.8:system
[INFO] | +- org.apache.hadoop:hadoop-client:jar:2.7.7:compile
[INFO] | | +- org.apache.hadoop:hadoop-mapreduce-client-app:jar:2.7.7:compile
[INFO] | | | +- org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.7.7:compile
[INFO] | | | | +- org.apache.hadoop:hadoop-yarn-client:jar:2.7.7:compile
[INFO] | | | | \- org.apache.hadoop:hadoop-yarn-server-common:jar:2.7.7:compile
[INFO] | | | \- org.apache.hadoop:hadoop-mapreduce-client-shuffle:jar:2.7.7:compile
[INFO] | | +- org.apache.hadoop:hadoop-yarn-api:jar:2.7.7:compile
[INFO] | | \- org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.7.7:compile
[INFO] | +- org.apache.hadoop:hadoop-mapreduce-client-core:jar:2.7.7:compile
[INFO] | | +- org.apache.hadoop:hadoop-yarn-common:jar:2.7.7:compile
[INFO] | | | +- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] | | | | +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | | | | \- javax.activation:activation:jar:1.1:compile
[INFO] | | | +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] | | | +- com.sun.jersey:jersey-core:jar:1.9:compile
[INFO] | | | +- com.sun.jersey:jersey-client:jar:1.9:compile
[INFO] | | | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] | | | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] | | | +- com.google.inject:guice:jar:3.0:compile
[INFO] | | | | +- javax.inject:javax.inject:jar:1:compile
[INFO] | | | | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] | | | \- com.sun.jersey.contribs:jersey-guice:jar:1.9:compile
[INFO] | | +- com.google.inject.extensions:guice-servlet:jar:3.0:compile
[INFO] | | \- io.netty:netty:jar:3.6.2.Final:compile
[INFO] | +- org.apache.hadoop:hadoop-hdfs:jar:2.7.7:compile
[INFO] | | +- commons-daemon:commons-daemon:jar:1.0.13:compile
[INFO] | | +- io.netty:netty-all:jar:4.0.23.Final:compile
[INFO] | | \- org.fusesource.leveldbjni:leveldbjni-all:jar:1.8:compile
[INFO] | \- org.apache.yetus:audience-annotations:jar:0.5.0:compile
[INFO] +- org.apache.hbase:hbase-client:jar:2.0.5:compile
[INFO] | +- org.jruby.jcodings:jcodings:jar:1.0.18:compile
[INFO] | +- org.jruby.joni:joni:jar:2.1.11:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-databind:jar:2.9.2:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.2:compile
[INFO] \- junit:junit:jar:4.12:compile
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.132 s
[INFO] Finished at: 2021-04-22T20:58:23+08:00
[INFO] ------------------------------------------------------------------------
② 找到org.glassfish:javax.el:jar:3.0.1-b12:compile (version selected from constraint [3.0.0,)),发现是hbase-server依赖中引入了3.0.1导致的冲突,所以把他排除掉:
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-server</artifactId>
<version>2.0.5</version>
<!--
解决打包错误:Failure to find org.glassfish:javax.el:pom:3.0.1-b08-SNAPSHOT
-->
<exclusions>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
</exclusion>
</exclusions>
</dependency>
③重新打包ok。