0

我正在尝试hello-endpoint-framework使用maven archetype
我使用此命令构建项目来创建。

mvn archetype:generate -Dappengine-version=1.9.63 -Djava8=true -DCloudSDK_Tooling=false -Dapplication-id=your-app-id -Dfilter=com.google.appengine.archetypes:

我设置-Djava8=true是因为我想在java8中运行它。

这是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>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>

    <groupId>org.azeem.endpoints</groupId>
    <artifactId>endpoints</artifactId>

    <properties>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- Compile/runtime dependencies -->
        <!-- Uncomment to use Endpoints Frameworks v1.0 and comment the v2.0 section -->
        <!--<dependency>
              <groupId>com.google.appengine</groupId>
              <artifactId>appengine-endpoints</artifactId>
              <version>1.9.53</version>
        </dependency>-->
        <!-- End of Endpoints Frameworks v1.0 -->
        <!-- Endpoints Frameworks v2.0 -->
        <dependency>
            <groupId>com.google.endpoints</groupId>
            <artifactId>endpoints-framework</artifactId>
            <version>2.0.7</version>
        </dependency>
        <!-- End of Endpoints Frameworks v2.0 -->
        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>1.9.53</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </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>appengine-maven-plugin</artifactId>
                <version>1.3.1</version>
                <configuration>
                    <!-- deploy configuration -->
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>endpoints-framework-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <!-- plugin configuration -->
                    <hostname>YOUR-PROJECT-ID.appspot.com</hostname>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>display-dependency-updates</goal>
                            <goal>display-plugin-updates</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

在此之后,我运行此命令mvn clean package来构建项目。然后我跑mvn appengine:run了,但我得到了这个错误。appengine-maven-plugin:1.3.1 运行失败非零退出

我用-e重新运行我的命令,这就是我得到的。

[INFO]   com.google.cloud.tools:appengine-maven-plugin ........ 1.3.1 -> 1.3.2
[INFO]   com.google.cloud.tools:endpoints-framework-maven-plugin  1.0.0 -> 1.0.3

[INFO]
[WARNING] The following plugins do not have their version specified:
[WARNING]   maven-clean-plugin ........................ (from super-pom) 3.1.0
[WARNING]   maven-compiler-plugin ..................... (from super-pom) 3.7.0
[WARNING]   maven-deploy-plugin ....................... (from super-pom) 2.8.2
[WARNING]   maven-install-plugin ...................... (from super-pom) 2.5.2
[WARNING]   maven-resources-plugin .................... (from super-pom) 3.1.0
[WARNING]   maven-site-plugin ......................... (from super-pom) 3.7.1
[WARNING]   maven-surefire-plugin .................... (from super-pom) 2.21.0
[WARNING]   maven-war-plugin .......................... (from super-pom) 3.2.0
[INFO]
[WARNING] Project does not define minimum Maven version, default is: 2.0
[INFO] Plugins require minimum Maven version of: 3.0
[INFO] Note: the super-pom from Maven 3.5.3 defines some of the plugin
[INFO]       versions and may be influencing the plugins required minimum Maven
[INFO]       version.
[INFO]
[ERROR] Project does not define required minimum version of Maven.
[ERROR] Update the pom.xml to contain
[ERROR]     <prerequisites>
[ERROR]       <maven>3.0</maven>
[ERROR]     </prerequisites>
[INFO]
[INFO] Require Maven 2.0.1 to use the following plugin updates:
[INFO]   maven-war-plugin .............................................. 2.0.2
[INFO]
[INFO] Require Maven 2.0.2 to use the following plugin updates:
[INFO]   maven-site-plugin ........................................ 2.0-beta-7
[INFO]
[INFO] Require Maven 2.0.6 to use the following plugin updates:
[INFO]   maven-clean-plugin .............................................. 2.5
[INFO]   maven-deploy-plugin ........................................... 2.8.1
[INFO]   maven-install-plugin .......................................... 2.5.1
[INFO]   maven-resources-plugin .......................................... 2.6
[INFO]   maven-site-plugin ............................................. 2.0.1
[INFO]   maven-surefire-plugin ......................................... 2.4.3
[INFO]   maven-war-plugin ................................................ 2.4
[INFO]
[INFO] Require Maven 2.0.9 to use the following plugin updates:
[INFO]   maven-compiler-plugin ........................................... 3.1
[INFO]   maven-surefire-plugin .......................................... 2.17
[INFO]
[INFO] Require Maven 2.1.0 to use the following plugin updates:
[INFO]   maven-site-plugin ............................................. 2.1.1
[INFO]
[INFO] Require Maven 2.2.0 to use the following plugin updates:
[INFO]   maven-site-plugin ............................................... 3.0
[INFO]
[INFO] Require Maven 2.2.1 to use the following plugin updates:
[INFO]   maven-clean-plugin ............................................ 2.6.1
[INFO]   maven-compiler-plugin ........................................... 3.3
[INFO]   maven-deploy-plugin ........................................... 2.8.2
[INFO]   maven-install-plugin .......................................... 2.5.2
[INFO]   maven-resources-plugin .......................................... 2.7
[INFO]   maven-site-plugin ............................................. 3.7.1
[INFO]   maven-surefire-plugin .......................................... 2.20
[INFO]   maven-war-plugin ................................................ 2.6
[INFO]   org.codehaus.mojo:versions-maven-plugin ......................... 2.2
[INFO]
[INFO] Require Maven 3.0 to use the following plugin updates:
[INFO]   maven-clean-plugin ............................................ 3.1.0
[INFO]   maven-compiler-plugin ......................................... 3.7.0
[INFO]   maven-resources-plugin ........................................ 3.1.0
[INFO]   maven-surefire-plugin ........................................ 2.21.0
[INFO]   maven-war-plugin .............................................. 3.2.0
[INFO]   org.codehaus.mojo:versions-maven-plugin ......................... 2.5
[INFO]
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ en
dpoints ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\DELL\Downloads\Test\endpoint
s\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ endpoin
ts ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ endpoints ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) @ endpoints ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields
(file:/C:/Users/DELL/.m2/repository/com/thoughtworks/xstream/xstream/1.3.1/xstre
am-1.3.1.jar) to field java.util.Properties.defaults
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.x
stream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflect
ive access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Packaging webapp
[INFO] Assembling webapp [endpoints] in [C:\Users\DELL\Downloads\Test\endpoints\
target\endpoints-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\DELL\Downloads\Test\endpoints\src\main
\webapp]
[INFO] Webapp assembled in [187 msecs]
[INFO] Building war: C:\Users\DELL\Downloads\Test\endpoints\target\endpoints-1.0
-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] <<< appengine-maven-plugin:1.3.1:run (default-cli) < package @ endpoints
<<<
[INFO]
[INFO]
[INFO] --- appengine-maven-plugin:1.3.1:run (default-cli) @ endpoints ---
May 10, 2018 6:25:00 AM com.google.cloud.tools.appengine.cloudsdk.CloudSdk logCo
mmand
INFO: submitting command: C:\Program Files\Java\jdk-10.0.1\bin\java.exe -javaage
nt:C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appe
ngine\google\appengine\tools\java\lib\agent\appengine-agent.jar -Dappengine.sdk.
root=C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_ap
pengine\google\appengine\tools\java -cp C:\Program Files (x86)\Google\Cloud SDK\
google-cloud-sdk\platform\google_appengine\google\appengine\tools\java\lib\appen
gine-tools-api.jar com.google.appengine.tools.development.DevAppServerMain --all
ow_remote_shutdown --disable_update_check C:\Users\DELL\Downloads\Test\endpoints
\target\endpoints-1.0-SNAPSHOT
[INFO] GCLOUD: Warning: Google App Engine Java 7 runtime is deprecated.
[INFO] GCLOUD: Warning: See https://cloud.google.com/appengine/docs/deprecations
/java7
[INFO] GCLOUD: java.lang.RuntimeException: Unable to create a DevAppServer
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory.do
CreateDevAppServer(DevAppServerFactory.java:352)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory.ac
cess$000(DevAppServerFactory.java:31)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory$1.
run(DevAppServerFactory.java:285)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory$1.
run(DevAppServerFactory.java:282)
[INFO] GCLOUD:  at java.base/java.security.AccessController.doPrivileged(Native
Method)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory.cr
eateDevAppServer(DevAppServerFactory.java:281)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain$Start
Action.apply(DevAppServerMain.java:348)
[INFO] GCLOUD:  at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(
Parser.java:45)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.run(D
evAppServerMain.java:223)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerMain.main(
DevAppServerMain.java:214)
[INFO] GCLOUD: Caused by: java.lang.ClassCastException: ClassLoader is jdk.inter
nal.loader.ClassLoaders$AppClassLoader@7591083d, not a URLClassLoader.
[INFO] GCLOUD:  at com.google.apphosting.utils.security.SecurityManagerInstaller
.generatePolicyFile(SecurityManagerInstaller.java:139)
[INFO] GCLOUD:  at com.google.apphosting.utils.security.SecurityManagerInstaller
.install(SecurityManagerInstaller.java:94)
[INFO] GCLOUD:  at com.google.appengine.tools.development.DevAppServerFactory.do
CreateDevAppServer(DevAppServerFactory.java:329)
[INFO] GCLOUD:  ... 9 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.857 s
[INFO] Finished at: 2018-05-10T06:25:01+05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3
.1:run (default-cli) on project endpoints: Execution default-cli of goal com.goo
gle.cloud.tools:appengine-maven-plugin:1.3.1:run failed: Non zero exit: 1 -> [He
lp 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal c
om.google.cloud.tools:appengine-maven-plugin:1.3.1:run (default-cli) on project
endpoints: Execution default-cli of goal com.google.cloud.tools:appengine-maven-
plugin:1.3.1:run failed: Non zero exit: 1
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreaded
Builder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleSt
arter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccesso
rImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMetho
dAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launche
r.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:2
29)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launc
her.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356
)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-c
li of goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:run failed: Non z
ero exit: 1
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBui
ldPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreaded
Builder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleSt
arter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccesso
rImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMetho
dAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launche
r.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:2
29)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launc
her.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356
)
Caused by: com.google.cloud.tools.appengine.api.AppEngineException: Non zero exi
t: 1
    at com.google.cloud.tools.appengine.cloudsdk.process.NonZeroExceptionExitLis
tener.onExit (NonZeroExceptionExitListener.java:30)
    at com.google.cloud.tools.appengine.cloudsdk.internal.process.DefaultProcess
Runner.syncRun (DefaultProcessRunner.java:211)
    at com.google.cloud.tools.appengine.cloudsdk.internal.process.DefaultProcess
Runner.run (DefaultProcessRunner.java:137)
    at com.google.cloud.tools.appengine.cloudsdk.CloudSdk.runDevAppServer1Comman
d (CloudSdk.java:300)
    at com.google.cloud.tools.appengine.cloudsdk.CloudSdkAppEngineDevServer1.run
 (CloudSdkAppEngineDevServer1.java:131)
    at com.google.cloud.tools.maven.RunMojo.runServer (RunMojo.java:286)
    at com.google.cloud.tools.maven.RunMojo.execute (RunMojo.java:282)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBui
ldPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreaded
Builder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleSt
arter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccesso
rImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMetho
dAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launche
r.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:2
29)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launc
her.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356
)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException

C:\Users\DELL\Downloads\Test\endpoints>

我只了解一个错误项目没有定义所需的 Maven 最低版本。我在 pom 中设置了最低版本,但仍然是同样的错误。

在此之后,我还尝试更新 gcloud 组件gcloud components update但无法解决此错误。

我正在使用JDK10

我还有另一个问题,这个项目是针对java7还是针对java8的。我想在java8中运行这个项目,这就是我设置的原因-Djava8=true但我不认为这个项目是为 java8 环境创建的,是吗?如果不是,我该怎么做?

那么appengine-maven-plugin错误呢?我该如何解决这个问题?为什么我会看到这个,Cloud SDK有什么问题吗?或者还有什么别的原因。

4

1 回答 1

0

如此处所示:

<properties>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

这是 Java 7,所以,如果你想用 Java 8 运行它,你必须将 1.7 的两个外观都更改为 1.8。

appengine-maven-plugin的错误是您正在尝试使用 Java 7,同时在命令中说要使用 Java 8。

于 2018-05-10T10:35:16.120 回答