将Google App Engine应用程序(Java)导入Eclipse

时间:2013-10-05 05:15:23

标签: java eclipse google-app-engine

首先:我不确定这个问题是不是一个合适的地方所以如果您认为它有更多适合的空间请移动它。

我有一些基于GAE的项目,我需要导入到Eclipse。我下载了Eclipse EE(Kepler)的新版本并安装了App Engine插件。然后我从源代码创建了一个新项目,并尝试对其进行配置......这就是问题开始的地方。

当我尝试构建项目时,我得到3个错误:

The App Engine SDK '\incap-ii\build\web\WEB-INF\lib\appengine-api-1.0-sdk-1.8.0.jar' on the project's build path is not valid (SDK directory 'D:\incap-ii\build\web\WEB-INF\lib\appengine-api-1.0-sdk-1.8.0.jar' does not exist)    incap-ii        Unknown Google App Engine Problem
Project 'incap-ii' is missing required library: 'war/WEB-INF/lib/jsr107cache-1.1.jar'   incap-ii        Build path  Build Path Problem
The project cannot be built until build path errors are resolved    incap-ii        Unknown Java Problem

第一个错误表示无法找到某些jar文件,但显示的路径很奇怪。实际上它缺少一个指向工作区的部分(D:\workspaces\eclipse GAE\) - 休息,从incap-ii开始就可以了。我尝试配置Build Path或更改SDK路径:

config

如您所见,我在配置中有2个SDK。但是,我无法更改此项目中使用的那个:我从列表中选择appengine-java-1.8.5 - 1.8.5,单击确定,对话框窗口关闭但错误仍然存​​在,一旦我再次打开对话框,我看到了更改未保存(仍使用错误的更改)。

我应该改变一些特定的配置吗?

[编辑] 一些更多的解释/ screes(下面)。正如你在第1号屏幕上看到的我(preferences \ google \ appengine)我已经配置了2个appEgines:我手动下载和提取的(在屏幕上检查)和第二个由Google App Engine插件下载的appEgines。无论如何,当我检查项目首选项时,我看到3个引擎(屏幕2) - 额外的一个(选中)在项目目录中。正如我所说,我不能改变它,因为在我点击“确定”后,更改不会保存。但是,当我打开“配置SDK”(屏幕3)时,我只能看到两个外部引擎。我勒个去?我试图重新安装整个Eclipse,但它没有帮助......此外,当我使用Netbeans构建它并从shell运行时,我可以手动下载AppEngine来运行这个项目,所以引擎可能很好......

  1. enter image description here
  2. enter image description here
  3. enter image description here

2 个答案:

答案 0 :(得分:11)

我遇到的问题可能与您的问题相同。就我而言,Eclipse说:

  

App Engine SDK   ' C:\用户\ Takahiko.m2 \库\ COM \谷歌\应用服务引擎\应用服务引擎的API-1.0-SDK \ 1.8.8 \应用服务引擎的API-1.0-SDK-1.8.8.jar'   项目的构建路径无效(SDK位置   ' C:\用户\ Takahiko.m2 \库\ COM \谷歌\应用服务引擎\应用服务引擎的API-1.0-SDK \ 1.8.8 \应用服务引擎的API-1.0-SDK-1.8.8.jar'   不是目录)

这意味着Eclipse在搜索App Engine SDK的安装目录之前,在本地maven存储库(〜/ .m2 / repository)中找到了App Engine SDK二进制文件。

(1)在Eclipse中关闭项目

(2)使用文本编辑器打开项目的.classpath ,如果它包含与App Engine相关的classpathentry,如下所示:

<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/appengine-local-runtime-shared.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/el-api.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/jsp/repackaged-appengine-ant-1.7.1.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/jsp/repackaged-appengine-ant-launcher-1.7.1.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/jsp/repackaged-appengine-jasper-6.0.29.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/jsp/repackaged-appengine-jasper-el-6.0.29.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/jsp/repackaged-appengine-tomcat-juli-6.0.29.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/jsp-api.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/shared/servlet-api.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/appengine-tools-api.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/appengine-api-labs/v1/appengine-api-labs.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/appengine-endpoints/v1/appengine-endpoints-deps.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/appengine-endpoints/v1/appengine-endpoints.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/asm-4.0.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/datanucleus-api-jdo-3.1.3.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/datanucleus-api-jpa-3.1.3.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/datanucleus-appengine-2.1.2.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/datanucleus-core-3.1.3.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/geronimo-jpa_2.0_spec-1.0.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/jdo-api-3.0.1.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/datanucleus/v2/jta-1.1.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/jsr107/v1/appengine-jsr107cache-1.8.8.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/opt/user/jsr107/v1/jsr107cache-1.1.jar">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/lib/user/appengine-api-1.0-sdk-1.8.8.jar" sourcepath="C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/src/user/appengine-api-1.0-sdk-1.8.8-src.zip">
    <attributes>
        <attribute name="javadoc_location" value="file:/C:/Eclipse/eclipse-juno/plugins/com.google.appengine.eclipse.sdkbundle_1.8.8/appengine-java-sdk-1.8.8/docs/javadoc/"/>
    </attributes>
</classpathentry>

(3)删除所有classpathentry (与App Engine jar文件相关)。

(4)在 MAVEN2_CLASSPATH_CONTAINER之前添加GAE_CONTAINER

<classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>

(5)重新开启您的项目

答案 1 :(得分:1)

看起来您的SDK配置存在问题。

您的屏幕截图显示了项目的配置,但我认为您需要查看偏好设置 - &gt;谷歌 - &gt;应用引擎,并检查SDK的配置。我认为您项目中无法选择的项目可能会在那里显示错误,但无论哪种方式,您都可能希望删除并重新添加它并确保其路径有效。