3333import org .eclipse .core .runtime .preferences .IScopeContext ;
3434
3535import org .eclipse .m2e .core .internal .IMavenConstants ;
36+ import org .eclipse .m2e .core .internal .embedder .MavenProperties ;
3637import org .eclipse .m2e .core .project .IProjectConfiguration ;
3738import org .eclipse .m2e .core .project .ResolverConfiguration ;
3839
@@ -95,13 +96,6 @@ public static boolean saveResolverConfiguration(IProject project, IProjectConfig
9596 } else {
9697 projectNode .remove (P_LIFECYCLE_MAPPING_ID );
9798 }
98- File directory = configuration .getMultiModuleProjectDirectory ();
99- if (directory != null ) {
100- projectNode .put (P_BASEDIR , directory .getAbsolutePath ());
101- } else {
102- projectNode .remove (P_BASEDIR );
103- }
104-
10599 if (configuration .getConfigurationProperties () != null && !configuration .getConfigurationProperties ().isEmpty ()) {
106100 projectNode .put (P_PROPERTIES , propertiesAsString (configuration .getConfigurationProperties ()));
107101 } else {
@@ -122,27 +116,31 @@ public static boolean saveResolverConfiguration(IProject project, IProjectConfig
122116 public static IProjectConfiguration readResolverConfiguration (IProject project ) {
123117 IScopeContext projectScope = new ProjectScope (project );
124118 IEclipsePreferences projectNode = projectScope .getNode (IMavenConstants .PLUGIN_ID );
125- ResolverConfiguration configuration = new ResolverConfiguration (project );
126119 if (projectNode == null ) {
127- return configuration ;
120+ return new ResolverConfiguration ( project ) ;
128121 }
129-
130122 String version = projectNode .get (P_VERSION , null );
131123 if (version == null ) { // migrate from old config
132- return configuration ;
124+ return new ResolverConfiguration ( project ) ;
133125 }
126+ ResolverConfiguration configuration = new ResolverConfiguration ();
134127 configuration .setResolveWorkspaceProjects (projectNode .getBoolean (P_RESOLVE_WORKSPACE_PROJECTS , false ));
135128 configuration .setSelectedProfiles (projectNode .get (P_SELECTED_PROFILES , "" )); //$NON-NLS-1$
136129 configuration .setLifecycleMappingId (projectNode .get (P_LIFECYCLE_MAPPING_ID , (String ) null ));
137130 configuration .setProperties (stringAsProperties (projectNode .get (P_PROPERTIES , null )));
131+ configuration .setMultiModuleProjectDirectory (getBasedir (projectNode , project ));
132+ return configuration ;
133+ }
134+
135+ private static File getBasedir (IEclipsePreferences projectNode , IProject project ) {
138136 String basedirSetting = projectNode .get (P_BASEDIR , null );
139137 if (basedirSetting != null ) {
140138 File directory = new File (basedirSetting );
141139 if (directory .isDirectory ()) {
142- configuration . setMultiModuleProjectDirectory ( directory ) ;
140+ return directory ;
143141 }
144142 }
145- return configuration ;
143+ return MavenProperties . computeMultiModuleProjectDirectory ( project ) ;
146144 }
147145
148146 private static String propertiesAsString (Map <?, ?> properties ) {
0 commit comments