2017-01-30 136 views
0

我正在创建一个项目,以从交换服务器获取电子邮件。我正在通过EWS的帮助完成这项工作。使用EWS时出现奇怪异常

我有下面的依赖也会添加到我的pom.xml

<dependencies>  
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.17</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
      <version>1.7.10</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.microsoft.ews-java-api</groupId> 
      <artifactId>ews-java-api</artifactId> 
      <version>2.0</version> 
     </dependency> 
</dependencies> 

在我的代码,我发现了以下import错误。

进口microsoft.exchange.webservices.data.core.ExchangeService 不能得到解决

进口 microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion 不能得到解决

而且,我的包装上出现一个错误,如下所示。

类型 microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion 不能得到解决。从所需的.class文件

当我打开我的decencies树木是间接引用,我很惊讶地看到core.ExchangeService可用(请参见下面的截图)。但core.enumeration.misc.ExchangeVersion丢失。

enter image description here

请让我知道我该如何解决这些问题。

感谢

回答

0

这似乎是一个Eclipse的bug,虽然。重新启动Eclipse为我工作不错,希望这可以帮助别人了。 有关可能的解决方案,请参见[http://dev-answers.blogspot.de/2009/06/eclipse-build-errors-javalangobject.html][1],否则请尝试以下操作;

Close the project and reopen it. 
Clean the project (It will rebuild the buildpath hence reconfiguring with the JDK libraries) 

OR

Delete and Re-import the project and if necessary do the above steps again. 

OR

如果有什么不工作,请尝试与其他IDE它可能工作。

+0

感谢那个快速提示的朋友,我试了一下,当我没有找到任何解决方案时发布在这里。 – user3872094

+0

我想你试过maven干净也然后如果不是,那么也试试这个。如果你有其他任何IDE而不是eclipse plz,那么试一次。 –