Java로 Google 앱 엔진에 배포하려는 Maven 앱을 빌드 중입니다.
로컬 서버에서 테스트를 시도하는 시점에 도달했습니다. localhost:8080
명령을 실행하면 mvn clean package
다음과 같이 빌드 성공 프롬프트가 표시됩니다.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.284 s
[INFO] Finished at: 2017-01-06T12:32:58-05:00
[INFO] Final Memory: 29M/400M
[INFO] ------------------------------------------------------------------------
하지만 명령을 실행하면 다음과 mvn appengine:run
같은 오류 메시지가 나타납니다.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.259 s
[INFO] Finished at: 2017-01-06T12:33:03-05:00
[INFO] Final Memory: 8M/150M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'run' in plugin com.google.appengine:appengine-maven-plugin:1.9.48 among available goals backends_configure, backends_delete, backends_rollback, backends_start, backends_stop, backends_update, create-property, debug, devserver, devserver_start, devserver_stop, endpoints_get_client_lib, endpoints_get_discovery_doc, endpoints_get_swagger_doc, enhance, migrate_traffic, rollback, set_default_version, start_module_version, stop_module_version, update, update_cron, update_dispatch, update_dos, update_indexes, update_queues, vacuum_indexes -> [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/MojoNotFoundException
내 pom 파일에 appengine 스켈레톤 archtype의 플러그인을 추가했습니다.
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
또한 클라우드 메이븐 문서의 버전으로 변경했습니다.
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>1.9.48</version>
<configuration>
<set_default>true</set_default>
</configuration>
</plugin>
그리고 여전히 위의 오류가 발생합니다.
내가 추측하는 것은 플러그인이 누락되었다는 것입니다. 내 앱을 로컬에서 실행하는 방법과이를 만들기 위해 누락 된 사항을 알고 싶습니다.mvn appengine:run work
편집하다
이제 다음과 같이 수정하면 다음 오류가 발생합니다.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project java-adwords: Compilation failure
[ERROR] /home/seraf/java-adwords-maven/java-adwords/src/main/java/myApp/adwords_axis/MainApp.java:[11,19] doGet(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) in adwords_axis.MainApp cannot override doGet(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) in javax.servlet.http.HttpServlet
[ERROR] overridden method does not throw java.lang.Exception
[ERROR] -> [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/MojoFailureException
하지만 여기에 예외가 발생하는 Java 기본 코드가 있습니다.
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws Exception {
response.setContentType("text/plain");
response.getWriter().println("Test");
run();
}
run
플러그인에 그러한 목표가 없기 때문에 목표 를 찾을 수 없습니다. 나는 당신이 찾고 있다고 믿습니다 appengine:devserver
. Apache Maven 및 App Engine 플러그인 사용 의 개발 서버로 앱 테스트 섹션을 참조하세요 .
위의 편집에 표시된 두 번째 질문과 관련하여. 애매한 대답은 예외가 발생하는 문제를 가리 킵니다. 재정의 된 메서드는 IOException
뿐만 아니라 ServletException
.
와 같이 다소 복잡한 라이브러리로 작업 할 때 javax.servlet.*
이러한 유형의 오류를 방지하기 위해 IDE에서 메서드 스텁을 생성하도록하는 것이 가장 좋습니다. 하지만 처음에 경고 나 오류를 짖지 않았다는 사실에 다소 놀랐습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다