【问题标题】:Can't import com.auth0.jwt in Java project无法在 Java 项目中导入 com.auth0.jwt
【发布时间】:2019-10-19 15:07:32
【问题描述】:

我正在为 auth0 jwt library for Java 使用以下 Maven 依赖项:

<!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
<dependency>
    <groupId>com.auth0</groupId>
    <artifactId>java-jwt</artifactId>
    <version>3.8.1</version>
</dependency>

当我尝试像这样在 Java servlet 中导入包时:

com.auth0.jwt

auth0 未被识别,我收到消息 Cannot resolve symbole 'auth0'

我尝试了不同版本的依赖项,还清理和重建项目,关闭和打开 IntelliJ,但仍然无法识别。

我还查看了auth0 Java quickstart,这表明对于 Java servlet,我可能需要使用这些 Maven 依赖项:

<dependency>
  <groupId>com.auth0</groupId>
  <artifactId>mvc-auth-commons</artifactId>
  <version>1.+</version>
</dependency>
<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>3.1.0</version>
</dependency>

我已经在使用第二个(用于 servlet-api)。但是,com.auth0 依赖项根本没有被识别为有效的依赖项。

我可以尝试什么来导入com.auth0.jwt

【问题讨论】:

    标签: java maven dependencies jwt auth0


    【解决方案1】:

    我在 Google Cloud Endpoints 项目中尝试了相同的依赖项:

    <!-- https://mvnrepository.com/artifact/com.auth0/java-jwt -->
    <dependency>
        <groupId>com.auth0</groupId>
        <artifactId>java-jwt</artifactId>
        <version>3.8.1</version>
    </dependency>
    

    然后我可以导入com.auth.jwt。我猜这个库只能在 Endpoints API 中工作。

    【讨论】:

      猜你喜欢
      • 2017-06-24
      • 2022-01-08
      • 1970-01-01
      • 1970-01-01
      • 2018-03-27
      • 1970-01-01
      • 2019-05-30
      • 2021-02-04
      • 1970-01-01
      相关资源
      最近更新 更多