Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added Maven plugin for Eclipse section.

...

Now open up the scatours-launcher-jumpstart project in Eclipse (the project name comes from the Maven module name specified in the pom.xml file) and look for the JumpstartLauncher.java file. If you right click on that file and select Run As Application the sample should run.

3 - Using the Maven plugin for Eclipse

3.1 - Install the m2eclipse plugin into Eclipse

m2eclipse offers integration of Maven with the Eclipse platform. It provides two plugins which give you different levels of integration:

  • m2eclipse Core - will be installing of the core Wizards, the POM Editor, Maven Repository integration, and Maven integration.
  • m2eclipse Extras - will be installing more features like Maven SCM integration, Eclipse Web Tools Platform integration and others.

In order to install the plugins, open Eclipse and go to Help -> Install New Software.... In the newly opened window click Add... from the Work with area and enter the following update sites:

Continue installation by selecting which modules to install and accepting terms of agreement.

m2eclipse uses an embedded installation of Maven by default. This can be changed with a specific instance of Maven found on the disk by entering the Windows -> Preferences menu in Eclipse. Click the Maven section and all the Maven integration related options will be displayed. In the Installations category, changes can be performed regarding the Maven instance and configuration file to use.

3.2 - Import the SCA artifacts

Go to File -> Import... in the Eclipse menu. From the Maven category, choose Existing Maven Projects and click Next. In the next step, choose a root directory and the plugin will show you all the Maven projects inside it and it's subdirectories. Choose one of them and click Next. From here on, m2eclipse will take care of resolving the dependencies, generating the Eclipse specific files.

Notice the project icon containing an M in the top left corner indicating the Maven nature of the project. To disable the Maven nature of a project, right click on the project, go to the Maven context menu and click Disable Dependency Management.

3.3 - Running SCA contributions and webapps

Once imported, Maven projects can be run in Eclipse using the well-known context menu Run As and choosing the appropriate category.

Also, Maven related tasks (goals like compile, test, package, install, etc.) can be run by using the project context menu and going to the Maven sub-menu.

Web applications can also be run from inside the Servers view as the m2eclipse extras plugin provides integration with Eclipse WTP. This enables Eclipse to recognize web applications managed by Maven. To add an application to a server, right click the server in the Servers view and go to Add and Remove.... Select which apps to publish to a particular server. Managing server state (starting, stopping, restarting, starting in debug mode) can be done using the provided buttons in the Servers view. Source code or resource changes are automatically synchronized with the published version on the server. The view also indicates if the application server needs to be restarted in order to apply major changes.