通过命令行的Eclipse和Maven [英] Eclipse and Maven via command line

查看:265
本文介绍了通过命令行的Eclipse和Maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过跳过包含文件夹(编辑2 以及其他文件夹)的原型选择,在Eclipse IDE(版本3.71)中创建一个简单的Maven应用程序:

I can create a simple Maven application in the Eclipse IDE (version 3.71) by skipping archetype selection that contains folders (Edit 2 as well as other folders):

src/main/resources
src/test/resources

如果使用命令行,这些文件夹将丢失.我一直在使用maven指南,使用

These folders are missing if I use the command line. I have been using the maven guide to create a maven project for my eclipse IDE using the command line as specified on the Maven site

mvn archetype:generate -DgroupId=guide.ide.eclipse -DartifactId=guide-ide-eclipse

如何通过命令行模仿Eclipse的行为?我试图找到正确的archetypeID并将参数添加到没有成功.

How do I mimic Eclipse's behaviour via the command line? I have tried to find the correct archetypeID and add the arguments to no success.

编辑1

生成的maven项目包含在git存储库中,因此我可以按照

The resulting maven project is contained in a git repository so I can import the project as detailed in this question

推荐答案

长期以来,使用Maven的Eclipse插件已经发现了这种不一致的问题.如果使用Eclipse IDE执行Maven命令,它将无法完全按照Maven的方式工作与命令行一起使用.因此,大多数开发人员要做的是从命令行运行maven命令,然后执行

This inconsistency problem is long identified with the Eclipse plugin for Maven.If you use the Eclipse IDE for executing Maven commands, It will not work exactly the way that Maven works with command line. So what most developers do is, run the maven commands from command line and then execute

mvn eclipse:eclipse

更新Eclipse项目.之后,您将返回Eclipse IDE并刷新您的项目.那么您的项目将根据通过命令行所做的更改进行更新.

to update eclipse project. After that you go back to Eclipse IDE and refresh your project. then your project will be updated as per the changes done via command line.

还建议使用以下配置更新pom.xml:

It is also recommended to update your pom.xml with following configuration:

<plugin>
    <version>2.9</version>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <configuration>
        <wtpversion>2.0</wtpversion>
    </configuration>
</plugin>

这篇关于通过命令行的Eclipse和Maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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