java - json-schema-validator 的 Maven 依赖问题

标签 java maven jakarta-mail json-schema-validator

我在 pom.xml 中使用了 2 个依赖项。

 <dependency>
        <groupId>com.github.fge</groupId>
        <artifactId>json-schema-validator</artifactId>
        <version>2.2.6</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.5.0-b01</version>
    </dependency>

但是对于 json-schema-validator,javax.mail(版本 1.4.3)已经是一个依赖项。当我的应用程序启动时,我的邮件服务(版本 1.5.0-b01)根本无法工作。但是当我删除 json-schema-validator 依赖项时,邮件服务工作得很好。有人可以帮我解决这个问题吗?

最佳答案

转到您的项目并使用以下命令查看依赖关系树:

$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building com.greg 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ example-jar ---
[INFO] com.greg:example-jar:jar:1.0-SNAPSHOT
[INFO] +- com.github.fge:json-schema-validator:jar:2.2.6:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:3.0.0:compile
[INFO] |  +- joda-time:joda-time:jar:2.3:compile
[INFO] |  +- com.googlecode.libphonenumber:libphonenumber:jar:6.2:compile
[INFO] |  +- com.github.fge:json-schema-core:jar:1.2.5:compile
[INFO] |  |  +- com.github.fge:uri-template:jar:0.9:compile
[INFO] |  |  |  +- com.github.fge:msg-simple:jar:1.1:compile
[INFO] |  |  |  |  \- com.github.fge:btf:jar:1.2:compile
[INFO] |  |  |  \- com.google.guava:guava:jar:16.0.1:compile
[INFO] |  |  +- com.github.fge:jackson-coreutils:jar:1.8:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.2.3:compile
[INFO] |  |  |     +- com.fasterxml.jackson.core:jackson-annotations:jar:2.2.3:compile
[INFO] |  |  |     \- com.fasterxml.jackson.core:jackson-core:jar:2.2.3:compile
[INFO] |  |  \- org.mozilla:rhino:jar:1.7R4:compile
[INFO] |  +- javax.mail:mailapi:jar:1.4.3:compile
[INFO] |  \- net.sf.jopt-simple:jopt-simple:jar:4.6:compile
[INFO] \- javax.mail:mail:jar:1.5.0-b01:compile
[INFO]    \- javax.activation:activation:jar:1.1:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.819 s
[INFO] Finished at: 2017-06-16T08:01:10+01:00
[INFO] Final Memory: 14M/174M
[INFO] ------------------------------------------------------------------------

所以我猜您想确保获得最新版本的 javax.mail

<dependency>
    <groupId>com.github.fge</groupId>
    <artifactId>json-schema-validator</artifactId>
    <version>2.2.6</version>
    <exclusions>
      <exclusion>
         <groupId>javax.mail</groupId>
         <artifactId>mailapi</artifactId>
      </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.5.0-b01</version>
</dependency>

关于java - json-schema-validator 的 Maven 依赖问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44581207/

相关文章:

java - 任何方法重载都是编译时多态性吗?

java - 编程中的动态链接器是什么?

java - 如何将矩形数组分组为 "Islands"的连接区域?

scala - Maven 不会运行 scala 测试

asynchronous - Javamail 是异步的还是同步的?

java - 无法找到到所请求目标的有效证书路径 - 即使在导入证书后也会出错

java - 如何在我的依赖项中包含tools.jar?

java - PITest:配置未正确应用

JavaMail MimeMultiPart 不发送全部内容

java - 如何检查 Throwable 是否是由无效电子邮件地址导致的