Eclipse and Maven via command line

杀马特。学长 韩版系。学妹 提交于 2020-01-04 02:54:16

问题


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

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

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.

Edit1

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


回答1:


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

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.

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>


来源:https://stackoverflow.com/questions/12913218/eclipse-and-maven-via-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!