Path (@Nullable MavenProject mavenProject, String path) { if (!Paths.get(path).isAbsolute()) { if (mavenProject == null) { throw new IllegalArgumentException("Project should be not-nul for non-absolute paths"); } path = new File(mavenProject.getDirectory(), path).getPath(); } return new Path(path); }