0

spring boot と maven を使用して単純な Java Rest サービスをセットアップしようとしています。maven をダウンロードし、pom.xml を src と同じフォルダーに配置しているので、src & pom.xml -> main -> java ->こんにちは

hello フォルダー内で maven clean package を実行して jar ファイルをビルドしようとすると、コマンド maven not found と表示されます。

私はまだJava Web開発に比較的慣れていないので、すべてが正しく構成されていることを確認するのは難しいです。Maven をダウンロードしましたが、プロジェクトに実際の Maven ファイルが必要ですか?

どんな助けでも本当に感謝しています。

-アダム

アップデート:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.124s
[INFO] Finished at: Fri Oct 04 11:47:08 PDT 2013
[INFO] Final Memory: 4M/89M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this      directory (/Users/adam419/Desktop/Programming/Java/dd-servlet/src). Please verify you invoked   Maven from the correct directory. -> [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/MissingProjectException

編集:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/adam419/Desktop/Programming/Java/dd-servlet/src/main/java/hello/GreetingController.java:[3,7] error: class Greeting is public, should be declared in a file named Greeting.java
[ERROR] /Users/adam419/Desktop/Programming/Java/dd-  servlet/src/main/java/hello/Greeting.java:[3,7] error: duplicate class: hello.Greeting
[INFO] 2 errors 
4

2 に答える 2

0

Although you are making the mistake @Ralph has given in his answer, I don't think this mistake would give the error message you're getting. To me it sounds like you haven't installed maven correctly. The install steps are at the bottom of this page. Make sure you've followed the directions correctly.

The error you've added on says there's no pom at the directory you ran the command from. You need to run the command in the same directory that the "pom.xml" file is in.

于 2013-10-04T18:48:22.490 に答える