我正在遵循 Google Cloud文档 https://cloud.google.com/appengine/docs/flexible/java/using-cloud-sql来开发应用程序。
如文档所建议,mvn clean jetty:run
命令应用于本地测试应用程序。除此之外,我还尝试了其他命令,例如mvn compile
。以下是我在本地测试应用程序所遵循的步骤:-
右键单击我的项目-> 运行方式-> Maven构建,然后启动配置框,我在其中输入了mvn clean jetty:run
在目标文本框中,点击运行
以下是我的pom.xml文件:-
<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>
<groupId>LiveInBliss</groupId>
<artifactId>LiveInBliss</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<!-- [START resources] -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<!-- [END resources] -->
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.0.M0</version>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.2.v20170220</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud</artifactId>
<version>0.8.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.34.0</version>
</dependency>
<dependency> <!-- http://dev.mysql.com/doc/connector-j/en/ -->
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.5</version>
</dependency>
<dependency>
<groupId>com.google.cloud.sql</groupId>
<artifactId>mysql-socket-factory-connector-j-6</artifactId>
<version>1.0.10</version>
</dependency>
</dependencies>
<properties>
<!--
INSTANCE_CONNECTION_NAME from Cloud Console > SQL > Instance Details > Properties
or `gcloud sql instances describe <instance> | grep connectionName`
-->
<INSTANCE_CONNECTION_NAME>live-in-bliss:northamerica-northeast1:liveinbliss-99</INSTANCE_CONNECTION_NAME>
<user>root</user>
<password>my_password</password>
<database>liveinbliss</database>
<sqlURL>jdbc:mysql://google/$liveinbliss?cloudSqlInstance=$live-in-bliss:northamerica-northeast1:liveinbliss-99&socketFactory=com.google.cloud.sql.mysql.SocketFactory&user=$root&password=$Mohini24&useSSL=false</sqlURL>
</properties>
</project>
以下是我的错误日志:-
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< LiveInBliss:LiveInBliss >-----------------------
[INFO] Building LiveInBliss 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.305 s
[INFO] Finished at: 2018-10-08T18:28:24+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
请提出,我应该进行哪些更改。
谢谢
答案 0 :(得分:2)
仅输入干净的码头:运行,删除mvn。