@Test void shouldNotAddManagedDependencyWithProperties() throws IOException { AppArtifactCoords addedDep = new AppArtifactCoords("bar", "pops", "pom", "1"); assertThat(mavenBuildFile.addDependency(addedDep, false)).isFalse(); }
@Override protected boolean addDependency(AppArtifactCoords coords, boolean managed) { Model model = getModel(); final Dependency d = new Dependency(); d.setGroupId(coords.getGroupId()); d.setArtifactId(coords.getArtifactId()); if (!managed) { d.setVersion(coords.getVersion()); } if (coords.getClassifier() != null && !coords.getClassifier().isEmpty()) { d.setClassifier(coords.getClassifier()); } d.setType(coords.getType()); if ("pom".equalsIgnoreCase(coords.getType())) { d.setScope("import"); DependencyManagement dependencyManagement = model.getDependencyManagement(); if (dependencyManagement == null) { dependencyManagement = new DependencyManagement(); model.setDependencyManagement(dependencyManagement); } if (dependencyManagement.getDependencies() .stream() .map(this::toResolvedDependency) .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { dependencyManagement.addDependency(d); return true; } } else { if (model.getDependencies() .stream() .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { model.addDependency(d); return true; } } return false; }
MavenBuildFile extends BuildFile { @Override protected boolean addDependency(AppArtifactCoords coords, boolean managed) { Model model = getModel(); final Dependency d = new Dependency(); d.setGroupId(coords.getGroupId()); d.setArtifactId(coords.getArtifactId()); if (!managed) { d.setVersion(coords.getVersion()); } if (coords.getClassifier() != null && !coords.getClassifier().isEmpty()) { d.setClassifier(coords.getClassifier()); } d.setType(coords.getType()); if ("pom".equalsIgnoreCase(coords.getType())) { d.setScope("import"); DependencyManagement dependencyManagement = model.getDependencyManagement(); if (dependencyManagement == null) { dependencyManagement = new DependencyManagement(); model.setDependencyManagement(dependencyManagement); } if (dependencyManagement.getDependencies() .stream() .map(this::toResolvedDependency) .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { dependencyManagement.addDependency(d); return true; } } else { if (model.getDependencies() .stream() .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { model.addDependency(d); return true; } } return false; } }
MavenBuildFile extends BuildFile { @Override protected boolean addDependency(AppArtifactCoords coords, boolean managed) { Model model = getModel(); final Dependency d = new Dependency(); d.setGroupId(coords.getGroupId()); d.setArtifactId(coords.getArtifactId()); if (!managed) { d.setVersion(coords.getVersion()); } if (coords.getClassifier() != null && !coords.getClassifier().isEmpty()) { d.setClassifier(coords.getClassifier()); } d.setType(coords.getType()); if ("pom".equalsIgnoreCase(coords.getType())) { d.setScope("import"); DependencyManagement dependencyManagement = model.getDependencyManagement(); if (dependencyManagement == null) { dependencyManagement = new DependencyManagement(); model.setDependencyManagement(dependencyManagement); } if (dependencyManagement.getDependencies() .stream() .map(this::toResolvedDependency) .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { dependencyManagement.addDependency(d); return true; } } else { if (model.getDependencies() .stream() .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { model.addDependency(d); return true; } } return false; } MavenBuildFile(final Path projectDirPath, final QuarkusPlatformDescriptor platformDescriptor); }
MavenBuildFile extends BuildFile { @Override protected boolean addDependency(AppArtifactCoords coords, boolean managed) { Model model = getModel(); final Dependency d = new Dependency(); d.setGroupId(coords.getGroupId()); d.setArtifactId(coords.getArtifactId()); if (!managed) { d.setVersion(coords.getVersion()); } if (coords.getClassifier() != null && !coords.getClassifier().isEmpty()) { d.setClassifier(coords.getClassifier()); } d.setType(coords.getType()); if ("pom".equalsIgnoreCase(coords.getType())) { d.setScope("import"); DependencyManagement dependencyManagement = model.getDependencyManagement(); if (dependencyManagement == null) { dependencyManagement = new DependencyManagement(); model.setDependencyManagement(dependencyManagement); } if (dependencyManagement.getDependencies() .stream() .map(this::toResolvedDependency) .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { dependencyManagement.addDependency(d); return true; } } else { if (model.getDependencies() .stream() .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { model.addDependency(d); return true; } } return false; } MavenBuildFile(final Path projectDirPath, final QuarkusPlatformDescriptor platformDescriptor); @Override void writeToDisk(); @Override List<AppArtifactCoords> getDependencies(); @Override String getProperty(String propertyName); @Override BuildTool getBuildTool(); }
MavenBuildFile extends BuildFile { @Override protected boolean addDependency(AppArtifactCoords coords, boolean managed) { Model model = getModel(); final Dependency d = new Dependency(); d.setGroupId(coords.getGroupId()); d.setArtifactId(coords.getArtifactId()); if (!managed) { d.setVersion(coords.getVersion()); } if (coords.getClassifier() != null && !coords.getClassifier().isEmpty()) { d.setClassifier(coords.getClassifier()); } d.setType(coords.getType()); if ("pom".equalsIgnoreCase(coords.getType())) { d.setScope("import"); DependencyManagement dependencyManagement = model.getDependencyManagement(); if (dependencyManagement == null) { dependencyManagement = new DependencyManagement(); model.setDependencyManagement(dependencyManagement); } if (dependencyManagement.getDependencies() .stream() .map(this::toResolvedDependency) .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { dependencyManagement.addDependency(d); return true; } } else { if (model.getDependencies() .stream() .noneMatch(thisDep -> d.getManagementKey().equals(thisDep.getManagementKey()))) { model.addDependency(d); return true; } } return false; } MavenBuildFile(final Path projectDirPath, final QuarkusPlatformDescriptor platformDescriptor); @Override void writeToDisk(); @Override List<AppArtifactCoords> getDependencies(); @Override String getProperty(String propertyName); @Override BuildTool getBuildTool();  }