eclipse 父项目必须有 POM 的打包类型

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33729741/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:56:53  来源:igfitidea点击:

The parent project must have a packaging type of POM

javaeclipsemaven

提问by chom

I am trying to create a new maven module. Parent project is a Web Service and has pom.xml.

我正在尝试创建一个新的 maven 模块。父项目是一个 Web 服务并且有 pom.xml。

How can I fix this error and create a new module?

如何修复此错误并创建新模块?

enter image description here

在此处输入图片说明

回答by Khan

Update your parent project's pom.xmlby replacing packaging property from jar/warto pomas following...

更新您的父项目的pom.xml,将包装属性从jar/warto替换pom为如下...

<?xml version="1.0" encoding="UTF-8"?>
   <project xmlns="http://maven.apache.org/POM/4.0.0" 
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>project-group</groupId>
    <artifactId>webservice</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>project-name</name>
    <url>http://maven.apache.org</url>  
</project>

回答by Vinit Bhardwaj

Open POM.xml in eclipse Id->Overview->ArtifactId->Packaging(Select POM from dropdown)->Save then create new Maven module.

在 eclipse Id->Overview->ArtifactId->Packaging(从下拉列表中选择 POM)->Save 中打开 POM.xml 然后创建新的 Maven 模块。

回答by AMAR KUMAR

Change:

改变:

<packaging>[here you change][1]xml<packaging>

To:

到:

<packaging>pom<packaging>

Then save the file and then right click on Project Maven > Update projectand then launch your application.

然后保存文件,然后右键单击Project Maven > Update project并启动您的应用程序。