Gson Maven依赖项无法正确加载

时间:2019-02-24 07:02:18

标签: java gson maven-2

过去一个小时左右,我一直在为此挠头。我似乎无法弄清楚如何通过Maven的依赖管理器使用Gson。我在网上看到的所有内容似乎都表明我需要在## Matching the tree and the data (using the dispRity package) library(dispRity) ## Attributing rownames to the dataset rownames(p) <- p$MSW05_Binomial ## Cleaning both the data and the tree cleaned_data <- dispRity::clean.data(p, tree) ## Extracting the cleaned dataset and the cleaned tree clean_p <- cleaned_data$data clean_tree <- cleaned_data$tree ## Same for the complete tree all_traits <- clean_p$y names(all_traits) <- clean_p$MSW05_Binomial ## Plotting all species and their traits dotTree(clean_tree, all_traits) 文件中添加几行。所以到目前为止,我已经有了这个

pom.xml

它似乎什么也没做。构建项目不会导致任何构建失败,但是运行程序会捕获异常。输出如下:

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.8.5</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>

1 个答案:

答案 0 :(得分:0)

尝试更改库的范围。

<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.8.5</version>
  <scope>provided</scope>
</dependency>