English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Eclipse bietet eine großartige Erweiterung m2eclipse ,dieses Plugin kann Maven und Eclipse integrieren.
Eclipse verfügt in der neuesten Version über Maven, wir öffnen es, Windows->Einstellungen,wenn das folgende Bild angezeigt wird:
Niedriger2Einige Merkmale von Eclipse:
Das Zielprojekt von Maven kann in der Eclipse-Umgebung ausgeführt werden.
You can use the built-in console in Eclipse to directly view the output of Maven commands.
You can update Maven dependencies under the IDE.
You can use Eclipse to build Maven projects.
Eclipse implements automatic dependency management based on Maven's pom.xml.
It resolves dependencies between Maven and the Eclipse workspace without installing them into the local Maven repository (the dependent project needs to be in the same workspace).
It can automatically download the required dependencies and source code from the remote Maven repository.
It provides a wizard to create a new Maven project, pom.xml, and enable Maven support on existing projects.
It provides a quick search for dependencies in the remote Maven repository.
Open Eclipse
Select File > Import > option
Select the 'Maven Projects' option. Click the 'Next' button.
Select the project path, which is the storage path when a project is created using Maven. Suppose we created a project: consumerBanking. Through Maven-Java-Projekt bauen View how to use Maven to create a project.
Click the 'Finish' button.
Now, you can see the Maven project in Eclipse.
Let's take a look at the properties of the consumerBanking project, you can find that Eclipse has already added all the dependencies of Maven to its build path.
Alright, let's use Eclipse's compilation feature to build this Maven project.
Right-click to open the context menu of the consumerBanking project
Select the 'Run' option
Then select the 'maven package' option
Maven starts building the project, you can see the output log in the Eclipse console.
[INFO] Scanning for projects... [INFO] ------------------------------------------------------------------- [INFO] Building consumerBanking [INFO] [INFO] Id: com.companyname.bank:consumerBanking:jar:1.0-SNAPSHOT [INFO] task-segment: [package] [INFO] ------------------------------------------------------------------- [INFO] [resources:resources] [INFO] Standardkodierung wird verwendet, um gefilterte Ressourcen zu kopieren. [INFO] [compiler:compile] [INFO] Nichts zu kompilieren - alle Klassen sind auf dem neuesten Stand [INFO] [resources:testResources] [INFO] Standardkodierung wird verwendet, um gefilterte Ressourcen zu kopieren. [INFO] [compiler:testCompile] [INFO] Nichts zu kompilieren - alle Klassen sind auf dem neuesten Stand [INFO] [surefire:test] [INFO] Surefire-Berichtverzeichnis: C:\MVN\consumerBanking\target\surefire-berichte ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.companyname.bank.AppTest Durchgeführte Tests: 1, Fehler: 0, Fehler: 0, Übersprungen: 0, Verstrichene Zeit: 0.047 sec Ergebnisse: Durchgeführte Tests: 1, Fehler: 0, Fehler: 0, Übersprungen: 0 [INFO] [jar:jar] [INFO] ------------------------------------------------------------------- [INFO] BUILDSUCCESSFUL [INFO] ------------------------------------------------------------------- [INFO] Gesamte Zeit: 1 second [INFO] Beendet am: Do Jul 12 18:18:24 IST 2012 [INFO] Letzte Speichergröße: 2M/15M [INFO] -------------------------------------------------------------------
Jetzt, mit der rechten Maustaste klicken App.java, wähle Als ausführen Optionen. Wähle Als Java-App
Du wirst wie folgt sehen:
Hallo Welt!