Parent projectParent = new Parent();
projectParent.setGroupId(parentPom.getGroupId());
projectParent.setArtifactId(parentPom.getArtifactId());
projectParent.setVersion(parentPom.getVersion());
DirectoryResource root = project.getProjectRoot();
DirectoryResource parentRoot = parent.getProjectRoot();
// Calculate parent relative path
String delta = root.getFullyQualifiedName().substring(parentRoot.getFullyQualifiedName().length());
String relativePath = delta.replaceAll("/(\\w+)", "../") + "pom.xml";
projectParent.setRelativePath(relativePath);
// Reuse GroupId and version from parent
pom.setGroupId(null);