Java Code Examples for org.apache.maven.model.Dependency#setExclusions()
The following examples show how to use
org.apache.maven.model.Dependency#setExclusions() .
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: DefaultPomDependenciesConverter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private Dependency createMavenDependency(ModuleDependency dependency, String name, String type, String scope, String classifier, Set<Configuration> configurations) { Dependency mavenDependency = new Dependency(); mavenDependency.setGroupId(dependency.getGroup()); if (dependency instanceof ProjectDependency) { mavenDependency.setArtifactId(determineProjectDependencyArtifactId((ProjectDependency) dependency)); } else { mavenDependency.setArtifactId(name); } mavenDependency.setVersion(dependency.getVersion()); mavenDependency.setType(type); mavenDependency.setScope(scope); mavenDependency.setOptional(false); mavenDependency.setClassifier(classifier); mavenDependency.setExclusions(getExclusions(dependency, configurations)); return mavenDependency; }
Example 2
Source File: DefaultPomDependenciesConverter.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
private Dependency createMavenDependency(ModuleDependency dependency, String name, String type, String scope, String classifier, Set<Configuration> configurations) { Dependency mavenDependency = new Dependency(); mavenDependency.setGroupId(dependency.getGroup()); if (dependency instanceof ProjectDependency) { mavenDependency.setArtifactId(determineProjectDependencyArtifactId((ProjectDependency) dependency)); } else { mavenDependency.setArtifactId(name); } mavenDependency.setVersion(dependency.getVersion()); mavenDependency.setType(type); mavenDependency.setScope(scope); mavenDependency.setOptional(false); mavenDependency.setClassifier(classifier); mavenDependency.setExclusions(getExclusions(dependency, configurations)); return mavenDependency; }
Example 3
Source File: DefaultPomDependenciesConverter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private Dependency createMavenDependency(ModuleDependency dependency, String name, String type, String scope, String classifier, Set<Configuration> configurations) { Dependency mavenDependency = new Dependency(); mavenDependency.setGroupId(dependency.getGroup()); if (dependency instanceof ProjectDependency) { mavenDependency.setArtifactId(determineProjectDependencyArtifactId((ProjectDependency) dependency)); } else { mavenDependency.setArtifactId(name); } mavenDependency.setVersion(dependency.getVersion()); mavenDependency.setType(type); mavenDependency.setScope(scope); mavenDependency.setOptional(false); mavenDependency.setClassifier(classifier); mavenDependency.setExclusions(getExclusions(dependency, configurations)); return mavenDependency; }
Example 4
Source File: DefaultPomDependenciesConverter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
private Dependency createMavenDependency(ModuleDependency dependency, String name, String type, String scope, String classifier, Set<Configuration> configurations) { Dependency mavenDependency = new Dependency(); mavenDependency.setGroupId(dependency.getGroup()); if (dependency instanceof ProjectDependency) { mavenDependency.setArtifactId(determineProjectDependencyArtifactId((ProjectDependency) dependency)); } else { mavenDependency.setArtifactId(name); } mavenDependency.setVersion(dependency.getVersion()); mavenDependency.setType(type); mavenDependency.setScope(scope); mavenDependency.setOptional(false); mavenDependency.setClassifier(classifier); mavenDependency.setExclusions(getExclusions(dependency, configurations)); return mavenDependency; }
Example 5
Source File: ExternalBomResolver.java From sundrio with Apache License 2.0 | 6 votes |
private Dependency toMavenDependency(org.eclipse.aether.graph.Dependency from) { org.eclipse.aether.artifact.Artifact fromArt = from.getArtifact(); Dependency dependency = new Dependency(); dependency.setGroupId(fromArt.getGroupId()); dependency.setArtifactId(fromArt.getArtifactId()); dependency.setVersion(fromArt.getVersion()); dependency.setType(fromArt.getExtension()); dependency.setScope(Artifact.SCOPE_COMPILE.equals(from.getScope()) ? null : from.getScope()); dependency.setClassifier(fromArt.getClassifier()); dependency.setOptional(dependency.isOptional()); if (from.getExclusions() != null && from.getExclusions().size() > 0) { List<Exclusion> exclusions = new LinkedList<Exclusion>(); for (org.eclipse.aether.graph.Exclusion fromEx : from.getExclusions()) { Exclusion ex = new Exclusion(); ex.setGroupId(fromEx.getGroupId()); ex.setArtifactId(fromEx.getArtifactId()); exclusions.add(ex); } dependency.setExclusions(exclusions); } return dependency; }
Example 6
Source File: ArtifactUtils.java From maven-jaxb2-plugin with BSD 2-Clause "Simplified" License | 6 votes |
public static void mergeDependencyWithDefaults(Dependency dep, Dependency def) { if (dep.getScope() == null && def.getScope() != null) { dep.setScope(def.getScope()); dep.setSystemPath(def.getSystemPath()); } if (dep.getVersion() == null && def.getVersion() != null) { dep.setVersion(def.getVersion()); } if (dep.getClassifier() == null && def.getClassifier() != null) { dep.setClassifier(def.getClassifier()); } if (dep.getType() == null && def.getType() != null) { dep.setType(def.getType()); } @SuppressWarnings("rawtypes") List exclusions = dep.getExclusions(); if (exclusions == null || exclusions.isEmpty()) { dep.setExclusions(def.getExclusions()); } }
Example 7
Source File: MavenCoordinatesResolver.java From smart-testing with Apache License 2.0 | 5 votes |
static Dependency createDependencyFromCoordinates(String coordinatesString, boolean excludeTransitive) { final String[] coordinates = coordinatesString.split(":"); int amountOfCoordinates = coordinates.length; if (amountOfCoordinates < 2) { throw new IllegalArgumentException( "Coordinates of the specified strategy [" + coordinatesString + "] doesn't have the correct format."); } final Dependency dependency = new Dependency(); dependency.setGroupId(coordinates[0]); dependency.setArtifactId(coordinates[1]); if (amountOfCoordinates == 3) { dependency.setVersion(coordinates[2]); } else if (amountOfCoordinates >= 4) { dependency.setType(coordinates[2].isEmpty() ? "jar" : coordinates[2]); dependency.setClassifier(coordinates[3]); } if (amountOfCoordinates >= 5) { dependency.setVersion(coordinates[4]); } if (amountOfCoordinates == 6) { dependency.setScope(coordinates[5]); } if (dependency.getVersion() == null || dependency.getVersion().isEmpty()) { dependency.setVersion(ExtensionVersion.version().toString()); } if (excludeTransitive) { Exclusion exclusion = new Exclusion(); exclusion.setGroupId("*"); exclusion.setArtifactId("*"); dependency.setExclusions(Arrays.asList(exclusion)); } return dependency; }