在Endpoints Frameworks 2.0 Migration之后访问`WEB-INF`文件夹

时间:2017-08-19 17:53:11

标签: java maven google-app-engine

AppEngine端点框架2.0迁移后,不允许像以前那样访问WEB-INF文件夹中的文件。

启动dev服务器时会抛出以下警告。

[INFO] GCLOUD: WARNING: Your working directory, (/Users/Name/Endpoint) is not equal to your
[INFO] GCLOUD: web application root (/Users/Name/Endpoint/target/endpoint-v1)
[INFO] GCLOUD: You will not be able to access files from your working directory on the production server.

pom.xml档案:

<dependencies>
    <!-- Compile/runtime dependencies -->
    <dependency>
        <groupId>com.google.endpoints</groupId>
        <artifactId>endpoints-framework</artifactId>
        <version>2.0.7</version>
    </dependency>

    <!-- Test Dependencies -->
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-testing</artifactId>
        <version>${appengine.sdk.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <!-- for hot reload of the web application -->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    <plugins>
        <plugin>
            <groupId>com.google.cloud.tools</groupId>
            <artifactId>endpoints-framework-maven-plugin</artifactId>
            <version>1.0.0</version>
            <configuration>
                <hostname>${appengine.app.id}.appspot.com</hostname>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <webXml>${project.build.directory}/generated-sources/appengine-endpoints/WEB-INF/web.xml</webXml>
                <webResources>
                    <resource>
                        <directory>${basedir}/src/main/webapp/WEB-INF</directory>
                        <filtering>true</filtering>
                        <targetPath>WEB-INF</targetPath>
                    </resource>
                    <resource>
                        <!-- resources in src/main/resources, deployed to WEB-INF/res, not filtered -->
                        <directory>${basedir}/src/main/resources</directory>
                        <filtering>false</filtering>
                        <targetPath>WEB-INF/res</targetPath>
                    </resource>
                </webResources>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.google.cloud.tools</groupId>
            <artifactId>appengine-maven-plugin</artifactId>
            <version>1.3.1</version>
            <configuration>
                <enableJarClasses>false</enableJarClasses>
                <cloudSdkPath>/Applications/google-cloud-sdk</cloudSdkPath>
                <port>8080</port>
            </configuration>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案