简体   繁体   中英

Eclipse and Maven via command line

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

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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