zoukankan      html  css  js  c++  java
  • maven 聚合工程的创建和打包

    ---恢复内容开始---

    使用eclipse创建maven项目

    第一步:创建父工程hg-parent,如图;

    右击空白处,new创建新maven工程:

    搜索maven项目

    父工程使用pom打包方式

    第二步:创建子工程

    右击父工程,创建maven module工程:

    定义子工程,这里是以表现层为例,是web工程,所以打包方式为war,如果是其他非web工程就可以打包成jar,这一点需要注意。

    如果出现如下错误

    在学习maven模块化构建项目的时候遇到了如下报错信息:

    web.xml is missing and <failOnMissingWebXml> is set to true

    。这时候需要右击项目——>Java EE Tools——>Generate Deployment Descriptor Stub.然后系统会在src/main/webapp/WEB_INF文件加下创建web.xml文件。错误解决!

    完成后的目录结构

    父工程的pom.xml

    子工程pom.xml文件内容:

    最后一步,打包项目

    右键父工程,

     

    运行时出错了,暂未解决,,解决后再修改

    [INFO] Scanning for projects...
    [ERROR] [ERROR] Some problems were encountered while processing the POMs:
    [ERROR] Child module D:eclipse-workspacehg-parent1hg-parent-web of D:eclipse-workspacehg-parent1pom.xml does not exist @
    @
    [ERROR] The build could not read 1 project -> [Help 1]
    [ERROR]
    [ERROR] The project com.hg:hg-parent1:0.0.1-SNAPSHOT (D:eclipse-workspacehg-parent1pom.xml) has 1 error
    [ERROR] Child module D:eclipse-workspacehg-parent1hg-parent-web of D:eclipse-workspacehg-parent1pom.xml does not exist
    [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/ProjectBuildingException

    注:本人正在学习中,还没调试成功,望牛人指点.项目中各种配置都没写还.

    ---恢复内容结束---

    自立更生,艰苦奋斗!
  • 相关阅读:
    Python全栈-第四课 学习笔记
    Python全栈-第三课 学习笔记
    Python全栈-第二课 学习笔记
    计算机网络技术-交换基础和Vlan间路由 学习笔记
    Linux运维-04系统管理和操作命令
    Linux运维-03远程连接
    Linux运维-02操作系统和系统安装(虚拟机)
    Linux运维-01硬件组成概念介绍
    计算机网络技术-路由-OSPF 学习笔记
    python基础 day17 模拟博客园登录
  • 原文地址:https://www.cnblogs.com/javazxy/p/maven_eclipse.html
Copyright © 2011-2022 走看看