簡體   English   中英

Eclipse無法在maven項目中解析akka引用

[英]Eclipse unable to resolve akka reference in maven project

我正在嘗試遠程部署pi計算的akka​​ tutrials。 我正在使用eclipse juno的mvn項目。 我已經能夠為eclipse安裝maven插件並成功運行第一個pi claculation。 現在我正在嘗試第二個pi教程,其中涉及演員的遠程部署。 但是,當我在eclipse IDE中打開教程包時,看起來某些akka文件尚未被系統解析。 我已經在POM中定義了依賴項,但仍然是eclipse和maven抱怨。 當我在eclipse中運行maven編譯目標時,項目會被編譯,但是當我嘗試運行它時,它會給我錯誤。 以下是示例代碼段。

import akka.actor.UntypedActor; 
import akka.actor.ActorRef;
import akka.routing.CyclicIterator;
import akka.routing.InfiniteIterator;
import akka.routing.UntypedLoadBalancer;
eclipse complains that it cannot resolve the above importation

這是POM.XML文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>


    <name>Akka.Remote.Cluster</name>
  <groupId>Akka-Remote_Cluster</groupId>
  <artifactId>Akka.Remote.Cluster</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <url>http://akka.io</url>

  <dependencies>
      <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-actor</artifactId>
            <version>2.0.3</version>
        </dependency> 
   <dependency>
  <groupId>com.typesafe.akka</groupId>
  <artifactId>akka-remote</artifactId>
  <version>2.0.3</version>
</dependency>          
</dependencies>

    <repositories>
        <repository>
            <id>typesafe</id>
            <name>Typesafe Repository</name>
            <url>http://repo.typesafe.com/typesafe/releases/</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

這是eclipse的錯誤

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 

    at Akka_Remote_Cluster.Akka.Remote.Cluster.Pi.main(Pi.java:16)

關於問題是什么的任何建議

我修復了刪除和重新加載所需Maven工件的類似問題。 第一次下載以某種方式破壞了。

我想你需要從akka發行版(libs里面)手動導入config-0.3.1.jar

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM