Maven Eclipse plug-in

4. April 2009

Create eclipse projects from a maven repo.

  • Check out the source
  • Run mvn eclipse:clean to de sure that no eclipse settings exist
    • Also ensure that no .settings, .project .classpath files exist in the repo structure they should be in the svn ignore
  • Run mvn eclipse:eclipse
  • Open eclipse and set the workspace location to the same path where mvn eclipse:eclipse was executed.
  • Go to Files->Import then select General-> Maven Projects and select the current workspace location.
  • Now select all the projects shown in the list.
  • Click ok and wait for eclipse to build the workspace.

 

Setting up Eclipse to use the Proper Maven Settings.xml

In order to use the settings.xml file where maven reads the user settings from Eclipse needs to know the path to this file. The integration in Eclipse by default sets the path to the user settings.xml so if you use the global settings instead you need to change the path:

The two most common places to store the settings:

  • The Maven install: $M2_HOME/conf/settings.xml
  • A user's install: ${user.home}/.m2/settings.xml

 

Settings can be stored at these locations in the respected files.

  • Per Project
    • Defined in the POM itself (pom.xml).
  • Per User
    • Defined in the Maven-settings (%USER_HOME%/.m2/settings.xml).
  • Global
    • Defined in the global maven-settings (%M2_HOME%/conf/settings.xml).
  • Profile descriptor
    • a descriptor located in project basedir (profiles.xml)

  

Set default profile in settings.xml

To set the default profile in the settings file insert this tag.

<activeProfiles>
    <activeProfile>profile-1</activeProfile>
</activeProfiles>

Get active profile

To get the actine profile used in maven use this:

mvn help:active-profiles

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Maven

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading