简体   繁体   English

使用Maven和Eclipse设置动态Web项目

[英]Setting up a dynamic web project with maven and eclipse

I am setting up a web project with maven and eclipse 我正在用Maven和Eclipse建立一个Web项目

I followed the steps given here Java Dynamic Web project with Maven and Eclipse 我按照此处给出的步骤使用Maven和Eclipse进行Java动态Web项目

Now in my eclipse IDE I have a web project with the maven directory structure, I have installed m2e plugin. 现在在我的Eclipse IDE中,我有一个带有maven目录结构的Web项目,我已经安装了m2e插件。 On doing right click on the project I see a maven option. 在右键单击项目时,我看到一个maven选项。

Now I am a little confused. 现在我有点困惑。 How do I clean build and run the project? 如何清理构建和运行项目? In the tutorials on the net I see a black command prompt where developers run some commands. 在网上的教程中,我看到一个黑色的命令提示符,开发人员在其中运行一些命令。 Is something else to be done?. 还有其他事情要做吗? Do I have to install maven in my windows system? 我必须在Windows系统中安装Maven吗? Won't I be able to do all the process from within eclipse? 我不能在Eclipse中完成所有过程吗?

How do I clean build and run the project? 如何清理构建和运行项目?

You will find on the option here right-click on the project --> Run as --> Maven clean/build/install 您将在这里的选项上找到右键单击项目->运行方式-> Maven清理/构建/安装

  1. Maven Clean will fire the mvn clean command Maven Clean将触发mvn clean命令
  2. Maven Install will fire the mvn install Maven安装将触发mvn安装
  3. Maven Build . Maven构建。 Thats just a generic interface to define custom goals and properties for a new maven build configuration. 多数民众赞成在只是一个通用的界面来定义新的Maven构建配置的自定义目标和属性。

In the tutorials on the net I see a black command prompt where developers run some commands. 在网上的教程中,我看到一个黑色的命令提示符,开发人员在其中运行一些命令。 Is something else to be done?. 还有其他事情要做吗? Do I have to install maven in my windows system? 我必须在Windows系统中安装Maven吗?

That is completely your choice, if you are comfortable with using the maven from command prompt then yes you will have to install maven in your operating system also. 那完全是您的选择,如果您习惯使用命令提示符下的maven,那么是的,您还必须在操作系统中安装maven。 Otherwise if you just going to use maven from within eclipse, then you don't have to set it up on your OS at all 否则,如果您只是要在eclipse中使用Maven,则根本不需要在OS上进行设置

Won't I be able to do all the process from within eclipse? 我不能在Eclipse中完成所有过程吗?

Yes you can, but sometimes some other commands have to be used besides clean/install , like the deploy command, or any-other , for that, take a look into the Maven Build option. 是的,您可以,但是有时需要使用clean / install之外的其他一些命令(例如deploy命令)或any-other,为此,请查看Maven Build选项。 You can make custom configurations here from within eclipse and fire any maven command with arguments as you like. 您可以在eclipse中进行自定义配置,并根据需要触发任何带有参数的maven命令。

you can also run from eclipse your project> Run as>maven>clean or build or install. 您也可以从Eclipse中运行your project> Run as>maven>clean或构建或安装。

for this you need to configure you eclipse to have maven in it. 为此,您需要配置Eclipse以使其具有Maven。

if you have maven installed in your directory. 如果您的目录中已安装maven。

then in eclipse 然后在日食

windows>preference>maven>Installation> add your maven directory here. windows>preference>maven>Installation>在此处添加您的maven目录。

after this you dont need to clean build project through command prompt , you can do in your eclipse. 之后,您不需要通过命令提示符来清理构建项目,就可以在Eclipse中进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM