Eclipse and Maven via command line

14,371

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>
Share:
14,371

Related videos on Youtube

Codey McCodeface
Author by

Codey McCodeface

Updated on August 19, 2022

Comments

  • Codey McCodeface
    Codey McCodeface over 1 year

    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