我正在尝试使用spring boot和maven设置一个简单的java rest服务,我已经下载了maven,并且我的pom.xml位于与src相同的文件夹中,所以它是 src& pom.xml - >主要 - > java - >你好
当我在hello文件夹中并尝试运行maven clean package来构建我的jar文件时,它说找不到命令maven。
我仍然是java web dev的新手,所以确保一切都配置正确对我来说很难。我已经下载了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
答案 0 :(得分:0)
pom.xml必须位于" root"文件夹中。
/yourApp:
- pom.xml
- /src
- /main/java
...
- /test/java
...
答案 1 :(得分:0)
虽然你正在犯@Ralph在他的回答中给出的错误,但我不认为这个错误会给出你得到的错误信息。对我而言,听起来你还没有正确安装maven。 The install steps are at the bottom of this page。确保您已正确遵循指示。
您添加的错误表示您运行命令的目录中没有pom。您需要在“pom.xml”文件所在的同一目录中运行该命令。