Java Code Examples for org.apache.maven.model.Dependency#getManagementKey()
The following examples show how to use
org.apache.maven.model.Dependency#getManagementKey() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GradleBuildFileTest.java From quarkus with Apache License 2.0 | 6 votes |
@Test void testGetDependencies() throws IOException { List<Dependency> dependencies = buildFile.getDependencies(); assertThat(dependencies).isNotEmpty(); List<String> depsString = new ArrayList<>(); for (Iterator<Dependency> depIter = dependencies.iterator(); depIter.hasNext();) { Dependency dependency = depIter.next(); String managementKey = dependency.getManagementKey(); if (dependency.getVersion() != null && !dependency.getVersion().isEmpty()) { managementKey += ':' + dependency.getVersion(); } depsString.add(managementKey); } assertThat(depsString).contains("io.quarkus:quarkus-jsonp:jar:0.23.2", "io.quarkus:quarkus-jsonb:jar:0.23.2", "io.quarkus:quarkus-resteasy:jar:0.23.2"); }
Example 2
Source File: ConfluenceDeployMojo.java From maven-confluence-plugin with Apache License 2.0 | 6 votes |
/** * * @param projectId * @param dependencyManagement * @return * @throws ProjectBuildingException */ private Map<String,Artifact> createManagedVersionMap(String projectId, DependencyManagement dependencyManagement) throws ProjectBuildingException { Map<String,Artifact> map; if (dependencyManagement != null && dependencyManagement.getDependencies() != null) { map = new HashMap<>(); for (Dependency d : dependencyManagement.getDependencies()) { try { VersionRange versionRange = VersionRange.createFromVersionSpec(d.getVersion()); Artifact artifact = factory.createDependencyArtifact(d.getGroupId(), d.getArtifactId(), versionRange, d.getType(), d.getClassifier(), d.getScope()); map.put(d.getManagementKey(), artifact); } catch (InvalidVersionSpecificationException e) { throw new ProjectBuildingException(projectId, "Unable to parse version '" + d.getVersion() + "' for dependency '" + d.getManagementKey() + "': " + e.getMessage(), e); } } } else { map = Collections.emptyMap(); } return map; }
Example 3
Source File: RawXJC2Mojo.java From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License | 5 votes |
private void merge(final Map<String, Dependency> dependencyMap, final List<Dependency> managedDependencies) { for (final Dependency managedDependency : managedDependencies) { final String key = managedDependency.getManagementKey(); final Dependency dependency = (Dependency) dependencyMap.get(key); if (dependency != null) { ArtifactUtils.mergeDependencyWithDefaults(dependency, managedDependency); } } }
Example 4
Source File: Dependencies.java From flatten-maven-plugin with Apache License 2.0 | 4 votes |
/** * @param dependency is the {@link Dependency} to {@link Map#put(Object, Object) put} or {@link Map#get(Object) get} * . * @return the {@link java.util.Map.Entry#getKey() key} for the {@link Dependency}. */ protected String getKey( Dependency dependency ) { return dependency.getManagementKey() + ":" + dependency.getClassifier(); }