Model (@NotNull Model result, File basedir) { try { CustomMaven3ModelInterpolator2 interpolator = new CustomMaven3ModelInterpolator2(); if (VersionComparatorUtil.compare(System.getProperty(MavenServerEmbedder.MAVEN_EMBEDDER_VERSION), "3.8.5") >= 0) { try { Class<?> clazz = Class.forName("org.apache.maven.model.interpolation.DefaultModelVersionProcessor"); Constructor<?> constructor = clazz.getConstructor(); Object component = constructor.newInstance(); Method processor = interpolator.getClass() .getMethod("setVersionPropertiesProcessor", Class.forName("org.apache.maven.model.interpolation.ModelVersionProcessor")); processor.invoke(interpolator, component); } catch (Exception e) { MavenServerGlobals.getLogger().error(e); } } //interpolator.initialize(); Properties userProperties = new Properties(); userProperties.putAll(MavenServerConfigUtil.getMavenAndJvmConfigPropertiesForBaseDir(basedir)); ModelBuildingRequest request = new DefaultModelBuildingRequest(); request.setUserProperties(userProperties); request.setSystemProperties(MavenServerUtil.collectSystemProperties()); request.setBuildStartTime(new Date()); request.setRawModel(result); interpolator.setPathTranslator(new PathTranslator() { @Override public String alignToBaseDirectory(String path, File basedir) { String result = path; if (path != null && basedir != null) { path = path.replace('\\', File.separatorChar).replace('/', File.separatorChar); File file = new File(path); if (file.isAbsolute()) { result = file.getPath(); } else if (file.getPath().startsWith(File.separator)) { result = file.getAbsolutePath(); } else { result = (new File((new File(basedir, path)).toURI().normalize())).getAbsolutePath(); } } return result; } }); List<ModelProblemCollectorRequest> problems = new ArrayList<>(); result = interpolator.interpolateModel(result, basedir, request, new ModelProblemCollector() { @Override public void add(ModelProblemCollectorRequest request) { problems.add(request); } }); for (ModelProblemCollectorRequest problem : problems) { if (problem.getException() != null) { MavenServerGlobals.getLogger().warn(problem.getException()); } } } catch (Exception e) { MavenServerGlobals.getLogger().error(e); } return result; }