当前位置: 首页 > 知识库问答 >
问题:

面向多模块项目的Maven配置

公孙琛
2023-03-14

我正在学习本教程https://spring.io/guides/gs/multi-module/#scratch

在根目录中,我创建了3个目录:moduleA、moduleB和moduleC

我运行了mvn-n io.takari:maven:wrapper

MacBook-Pro-de-calzada:multi-module-project-example nunito$ sudo ./mvnw
/Users/nunito/Development/J2EE/workspace-sts-3.8.4.RELEASE/multi-module-project-example
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.066 s
[INFO] Finished at: 2017-04-24T20:03:37+02:00
[INFO] Final Memory: 7M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. 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/NoGoalSpecifiedException
MacBook-Pro-de-calzada:multi-module-project-example nunito$ 
/Users/calzada/Development/J2EE/workspace-sts-3.8.4.RELEASE/multi-module-project-example
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.062 s
[INFO] Finished at: 2017-04-24T22:38:20+02:00
[INFO] Final Memory: 8M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/calzada/Development/J2EE/workspace-sts-3.8.4.RELEASE/multi-module-project-example). 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
MacBook-Pro-de-calzada:multi-module-project-example nunito$ 

共有1个答案

孟绪
2023-03-14

您需要一个pom.xml文件才能运行./mvnw clean install

[ERROR]您指定的目标需要执行一个项目,但该目录中没有POM(/users/calzada/development/j2ee/workspace-sts-3.8.4.release/multi-module-project-example)。

在本教程中,您可以了解用于多模块项目的Maven配置和用于库的Maven配置。在那里您将找到必要的pom.xml文件。

 类似资料:
  • 我曾广泛使用过Maven 目前有5个不同的maven项目,每个项目都有一个不同的pom.xml。到目前为止,它们之间存在依赖关系,如果需要,每一个都指向 中的另一个。 现在我们不喜欢的是 当我们发布子projectA时,我们需要手动修改所有将projectA作为依赖项的项目以使用新版本。Saw Maven有一个版本插件,不知道这会有什么帮助。 作为解决方案,我希望在POM之间有一个更干净的组织,并

  • 我有一个问题,为我的多模块maven项目正确设置Spring启动。 有一个模块“api”使用另一个模块“core”。Api有一个应用程序。包含spring的属性文件。邮政主机=xxx。根据Spring Boot文档,这为您提供了JavaMailSender接口的默认实现,可以自动连接。 然而,负责发送电子邮件的类驻留在“核心”包中。当我尝试构建该模块时,构建失败,因为找不到JavaMailSend

  • 我有一个多模块maven应用程序,我们需要通过Jenkins构建。项目结构如下: 现在,mvn清洁安装-fa.xml工作正常。为此,我创建了一个詹金斯的工作。现在,和a.xml一样,我有另一个项目b.xml.b.xml有和a.xml相同的代码,除了不同的Ids。所以,我又为詹金斯创造了一份工作b.xml.两份工作都很好。但是,现在我想根据我们在Git中提交的项目,从单个Jenkins工作中构建这两

  • 关于maven项目结构,我有两个问题: 1)我正在创建一个maven多模块项目,并且想知道是否可以将模块的所有公共依赖项放在父POM中?这是正确的做法吗? 2)如果我正在创建一个包含所有web.xml和JSP文件的maven webapp项目,那么web控制器、侦听器和模型对象应该驻留在哪里?在一个单独的maven jar项目中还是在同一个webapp项目中?

  • 问题内容: 我正在研究一个多模块Maven项目,其结构如下: war模块取决于jar模块,并将打包后将jar工件添加到webapp的lib目录中。 war模块和jar模块都使用Apache log4j进行日志记录,并共享相同的log4j配置文件(log4j.xml),该文件当前位于jar模块项目中。并且此log4j.xml将打包到jar- module.jar文件中,但是,我想将其放入war包中而

  • 我有以下Maven项目结构: i、 e.Project1、Project2和Project3在目录结构上是对等的,它们都是Spring Boot应用程序(JAR)。我想将Project2和Project3视为Project1的子项,而不改变目录结构。当我在父项目上执行相同的maven命令时,我需要在子项目上过渡地执行所有maven命令。而且最重要的是,我应该能够将它们打包到一个JAR文件中。我在谷