@@ -165,20 +165,21 @@ protected MavenExecutionRequest newExecutionRequest() throws CoreException {
165165 .orElseGet (workspaceConfiguration ::getSettingsLocations );
166166 if (request == null ) {
167167 //create a fresh one ....
168- request = createExecutionRequest (workspaceConfiguration , containerLookup , mavenSettingsLocations );
168+ request = createExecutionRequest (workspaceConfiguration , containerLookup , mavenSettingsLocations ,
169+ multiModuleProjectDirectory );
169170 request .setBaseDirectory (basedir );
170171 } else {
171172 //update existing configuration, we might have copied from an outer context here, but if the multi-module directory is different, we need to update some things...
172173 Settings settings = MavenPlugin .getMaven ().getSettings (mavenSettingsLocations );
173174 File requestLocalRepositoryPath = request .getLocalRepositoryPath ();
174- File settingsLocalRepositoryPath = getLocalRepositoryPath (settings );
175+ File settingsLocalRepositoryPath = getLocalRepositoryPath (settings , multiModuleProjectDirectory );
175176 if (!pathEquals (requestLocalRepositoryPath , settingsLocalRepositoryPath )) {
176177 updateLocalRepository (request , settingsLocalRepositoryPath , containerLookup );
177178 }
178179 //TODO maybe also need to update user properties?!?
179180 updateSettingsFiles (request , mavenSettingsLocations );
181+ request .setMultiModuleProjectDirectory (multiModuleProjectDirectory );
180182 }
181- request .setMultiModuleProjectDirectory (multiModuleProjectDirectory );
182183 }
183184 return request ;
184185 }
@@ -198,16 +199,14 @@ private boolean pathEquals(File file1, File file2) {
198199 }
199200
200201 static MavenExecutionRequest createExecutionRequest (IMavenConfiguration mavenConfiguration , IComponentLookup lookup ,
201- MavenSettingsLocations settingsLocations ) throws CoreException {
202+ MavenSettingsLocations settingsLocations , File multiModuleProjectDirectory ) throws CoreException {
202203 MavenExecutionRequest request = new DefaultMavenExecutionRequest ();
203204 // this causes problems with unexpected "stale project configuration" error markers
204205 // need to think how to manage ${maven.build.timestamp} properly inside workspace
205206 //request.setStartTime( new Date() );
206207 Settings settings = MavenPlugin .getMaven ().getSettings (settingsLocations );
207208 updateSettingsFiles (request , settingsLocations );
208-
209209 //and settings are actually derived from IMavenConfiguration
210-
211210 File userToolchainsFile = MavenCli .DEFAULT_USER_TOOLCHAINS_FILE ;
212211 if (mavenConfiguration .getUserToolchainsFile () != null ) {
213212 userToolchainsFile = new File (mavenConfiguration .getUserToolchainsFile ());
@@ -219,7 +218,7 @@ static MavenExecutionRequest createExecutionRequest(IMavenConfiguration mavenCon
219218 throw new CoreException (Status .error (Messages .MavenImpl_error_no_exec_req , ex ));
220219 }
221220
222- updateLocalRepository (request , getLocalRepositoryPath (settings ), lookup );
221+ updateLocalRepository (request , getLocalRepositoryPath (settings , multiModuleProjectDirectory ), lookup );
223222 request .setOffline (mavenConfiguration .isOffline ());
224223
225224 request .getUserProperties ().put ("m2e.version" , MavenPluginActivator .getVersion ()); //$NON-NLS-1$
@@ -231,6 +230,7 @@ static MavenExecutionRequest createExecutionRequest(IMavenConfiguration mavenCon
231230 request .setCacheTransferError (true );
232231
233232 request .setGlobalChecksumPolicy (mavenConfiguration .getGlobalChecksumPolicy ());
233+ request .setMultiModuleProjectDirectory (multiModuleProjectDirectory );
234234 return request ;
235235 }
236236
@@ -259,12 +259,14 @@ private static void updateLocalRepository(MavenExecutionRequest request, File lo
259259 request .setLocalRepositoryPath (localRepository .getBasedir ());
260260 }
261261
262- private static File getLocalRepositoryPath (Settings settings ) {
262+ private static File getLocalRepositoryPath (Settings settings , File multiModuleProjectDirectory ) {
263263 String localRepositoryPath = settings .getLocalRepository ();
264264 if (localRepositoryPath == null ) {
265265 return RepositorySystem .defaultUserLocalRepository ;
266266 }
267- return new File (localRepositoryPath );
267+ //Actually maven would resolve these against the current working directory,
268+ //as we have no such thing available the best we can use here is the root folder of the multimodule directory
269+ return new File (multiModuleProjectDirectory , localRepositoryPath ).getAbsoluteFile ();
268270 }
269271
270272 @ Override
0 commit comments