Maven Dependency Management Only

1. Maven Support for Dependencies Only

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s dependencies, builds, reporting, and documentation from a central piece of information. Maven dependency management is one of the best-known Maven features and is one of the areas where Maven excels. However, exploiting only this feature is typically not possible. You would need to go almost all the way with a Maven-based project configuration, adding and configuring Maven plugins, dealing with profiles, and goals. While MyEclipse fully supports advanced Maven development with all these features, if you only want dependency management, creating a full Maven project creates unnecessary project complexity. This is where the Dependencies Only mode comes in. Beginning in version 2015 CI 7, MyEclipse supports the use of Maven’s dependency resolution without requiring you to use full Maven build management.

2. Maven Support – Dependencies Only Facet

In MyEclipse 2015 CI 7 and later, you can find two Maven-related project facets. The Maven Support for Java EE Projects facet provides full Maven capabilities to your project. The Maven Support – Dependencies Only facet provides your project with only Maven dependency management capabilities.Maven dependency management onlyMaven Support – Dependencies Only facetDuring Dependencies Only facet installation, a Maven Dependencies classpath container for all Maven dependencies as specified in pom.xml is added to your project. The contents of this container will be deployed when you deploy this project. A pom.xml file is generated if it does not exist. You can make any changes to pom.xml; however, only dependency information is respected, and the Maven Dependencies container will be updated accordingly. All other project configuration metadata is ignored. There is no need to bother with additional Maven settings. Note: The Maven Support for Java EE Projects facet and the Maven Support – Dependencies Only facet are mutually exclusive. For full Maven support, you must use the former facet.

3. Use Cases

The sections below provide steps for several scenarios using the Maven Dependencies Only facet.

3.1 Adding the Dependencies Only Mode to a New Project

  1. Create a new Web/EJB project; do not choose the Add maven support checkbox.
  2. Right-click the project, and select properties.
  3. Expand MyEclipse, and choose Project Facets.
  4. Select the Maven Support – Dependencies Only facet.
  5. Click OK or Apply.

3.2 Converting an Existing Maven Project to Use the Dependencies Only Mode

  1. Right-click the project, and select Properties.
  2. Expand MyEclipse, and choose Project Facets.
  3. Deselect the Maven Support for Java EE Projects to uninstall the full Maven support facet.
  4. Select the Maven Support – Dependencies Only facet.
  5. Click OK or Apply.

3.3 Migrating Maven Projects from MyEclipse 10.x or Lower

MyEclipse 10.x and lower versions had incomplete Maven support that primarily dealt with dependencies only. If your project does not have a correctly configured pom.xml file, when your project is migrated into MyEclipse 2013 or later, you could experience issues during deployment.  Please reset your project to the state it was before migrating to MyEclipse 2015 and then perform the following steps to correctly migrate it.
  1. Open Project on the main menu bar, and disable Build Automatically (ensure it is unchecked).
  2. Import / checkout your projects into a workspace running MyEclipse 2015.
  3. When prompted to migrate your project, cancel the process or deselect the affected projects.
  4. Add the Maven Support – Dependencies Only facet to your projects as described above.
  5. Enable Build Automatically.
  6. Select MyEclipse>Migrate Workspace to complete the migration of these Maven projects.
Deployment should now be similar to deployment in MyEclipse 10.x. Note: This process will continue to be streamlined in future MyEclipse releases. When you are ready to switch to full Maven based configuration, simply uninstall this facet and install the Maven Support for Java EE Projects facet.