如何将Google App Engine与Webjars一起使用?

JJ *_*kar 5 java google-app-engine maven webjars

我有一个Google App Engine(1.8.5)项目.我想通过Webjars提供静态Javascript和CSS .但是,我一直在收到HTTP 404错误.如何使我的Webjars文件可访问?

src/main/webapp/WEB-INF/appengine-web.xml根据Google的文档:

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    ...
    <static-files>
        <include path="/resources/**" />
        <include path="/webjars/**" />
    </static-files>
</appengine-web-app> 
Run Code Online (Sandbox Code Playgroud)

我的src/main/webapp/index.html,引用了Webjars提供的Bootstrap CSS文件:

<html>
<head>
    <link rel="stylesheet" href="webjars/bootstrap/3.0.0/css/bootstrap.min.css">
</head>
...
</html>
Run Code Online (Sandbox Code Playgroud)

片段pom.xml:

    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>(lots)</artifactId>
        <version>1.8.5</version>
    </dependency>
    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>4.0-beta</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <scope>provided</scope>
        <version>3.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap</artifactId>
        <version>3.0.0</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

这是我的第一个GAE帖子问题,所以我不确定提供什么额外信息 - 温和,所以.

ᴇʟᴇ*_*ᴀтᴇ 2

不幸的是,Webjars 需要 Servlet 3.x 容器,但 Google App Engine 目前仍仅为 2.5 版本。

您可能想在 GAE 问题列表中为此问题加注星标。