使用Maven创建的Java Web项目不会被Eclipse识别 [英] A Java web project created with Maven is not recognized as such by Eclipse

查看:140
本文介绍了使用Maven创建的Java Web项目不会被Eclipse识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用maven创建了一个这样的web项目:

I created a web project with maven like this:

mvn archetype:create -DgroupId = com.mycompany.app -DartifactId = my -webapp -DarchetypeArtifactId = maven-archetype-webapp

然后我运行 mvn eclipse:eclipse 建立一个eclipse项目。 Eclipse识别项目的所有功能,但它不会将其识别为Web项目。

Then I run mvn eclipse:eclipse so that an eclipse project is built. Eclipse recognizes all the features of the project but it doesn't recognize it as a web project.

因此,当我在eclipse工作区内创建一个服务器,然后转到在我选择要部署到我的服务器的项目的对话框中,我没有提供部署我新创建的项目。

Therefore, when I create a server inside my eclipse workspace, and go to the dialog where I select what projects to deploy to my server, I am not offered to deploy my newly created project.

想法?

推荐答案

你应该在你的pom.xml中明确提到maven-eclipse-plugin应该生成一个WTP项目。一个简单的例子,它应该在构建部分的pom.xml中:

You should explicitly mention in your pom.xml that the maven-eclipse-plugin should generate a WTP-project. A simple example, which should be in your pom.xml at the build-part, would be:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
            <wtpmanifest>true</wtpmanifest>
            <wtpapplicationxml>true</wtpapplicationxml>
            <wtpversion>2.0</wtpversion>
        </configuration>
    </plugin>
</plugins>

这篇关于使用Maven创建的Java Web项目不会被Eclipse识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆