public static Exclusion cloneDependencyExclusion( Exclusion src ) { if ( src == null ) { return null; } Exclusion result = new Exclusion(); result.setArtifactId( src.getArtifactId() ); result.setGroupId( src.getGroupId() ); return result; }
public static Exclusion cloneExclusion( Exclusion src ) { Exclusion result = null; if ( src != null ) { result = new Exclusion(); result.setArtifactId( src.getArtifactId() ); result.setGroupId( src.getGroupId() ); } return result; }
protected void mergeExclusion_GroupId( Exclusion target, Exclusion source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getGroupId(); if ( src != null ) { if ( sourceDominant || target.getGroupId() == null ) { target.setGroupId( src ); target.setLocation( "groupId", source.getLocation( "groupId" ) ); } } }
exclusion.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
exclusion.setGroupId( interpolatedTrimmed( parser.nextText(), "groupId" ) );
public static Exclusion parse(final Object value) { assert value != null; if (value instanceof String) { Exclusion node = new Exclusion(); String[] items = ((String) value).split(":"); switch (items.length) { case 2: node.setGroupId(items[0]); node.setArtifactId(items[1]); return node; } } return null; } }
exclusion.setGroupId( getTrimmedValue( value ) );
String[] parts = exclusionStr.split(":"); Exclusion exclusion = new Exclusion(); exclusion.setGroupId(parts[0]); exclusion.setArtifactId(parts[1]); dependency.addExclusion(exclusion);
public static Exclusion parse(final Object value) { assert value != null; if (value instanceof String) { Exclusion node = new Exclusion(); String[] items = ((String) value).split(":"); switch (items.length) { case 2: node.setGroupId(items[0]); node.setArtifactId(items[1]); return node; } } return null; } }
private List<Exclusion> transformExclusions(List<Coordinate> excludedDependencies) { List<Exclusion> result = new ArrayList<Exclusion>(excludedDependencies.size()); for (Coordinate dependency : excludedDependencies) { Exclusion exclusion = new Exclusion(); exclusion.setArtifactId(dependency.getArtifactId()); exclusion.setGroupId(dependency.getGroupId()); result.add(exclusion); } return result; }
public List<Exclusion> parseExclusions(String exclusions) { List<Exclusion> result = new ArrayList<>(); if (StringUtils.isBlank(exclusions)) { return result; } Pattern.compile(";") .splitAsStream(exclusions) .forEach(s -> { String[] mavenIds = Pattern.compile(":").split(s, 2); if (mavenIds.length == 2) { Exclusion exclusion = new Exclusion(); exclusion.setGroupId(mavenIds[0]); exclusion.setArtifactId(mavenIds[1]); result.add(exclusion); } } ); return result; }
private void setExclusions(final Collection<org.sonatype.aether.graph.Exclusion> exclusions) { List<Exclusion> result = new ArrayList<Exclusion>(); for (org.sonatype.aether.graph.Exclusion exclusion : exclusions) { Exclusion temp = new Exclusion(); temp.setArtifactId(exclusion.getArtifactId()); temp.setGroupId(exclusion.getGroupId()); result.add(temp); } super.setExclusions(result); }
private void setExclusions(final Collection<org.eclipse.aether.graph.Exclusion> exclusions) { List<Exclusion> result = new ArrayList<>(); for (org.eclipse.aether.graph.Exclusion exclusion : exclusions) { Exclusion temp = new Exclusion(); temp.setArtifactId(exclusion.getArtifactId()); temp.setGroupId(exclusion.getGroupId()); result.add(temp); } super.setExclusions(result); }
protected void mergeExclusion_GroupId( Exclusion target, Exclusion source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getGroupId(); if ( src != null ) { if ( sourceDominant || target.getGroupId() == null ) { target.setGroupId( src ); target.setLocation( "groupId", source.getLocation( "groupId" ) ); } } }
/** * Interpolates elements of the {@link Exclusion} object. * * @param exclusion * {@link Exclusion} object whose elements to interpolate. */ private void interpolateExclusion(final Exclusion exclusion) { exclusion.setArtifactId( interpolateString(exclusion.getArtifactId())); exclusion.setGroupId( interpolateString(exclusion.getGroupId())); }
private static Exclusion exclusion(String pom) { Exclusion exclusion = new Exclusion(); DefaultArtifact artifact = artifact(pom); exclusion.setGroupId(artifact.getGroupId()); exclusion.setArtifactId(artifact.getArtifactId()); return exclusion; }
private static void interpolate(Map<String, String> dict, Iterable<Dependency> dependencies) { if (dependencies == null) { return; } for (Dependency d: dependencies) { d.setGroupId(interpolate(dict, d.getGroupId())); d.setArtifactId(interpolate(dict, d.getArtifactId())); d.setVersion(interpolate(dict, d.getVersion())); d.setClassifier(interpolate(dict, d.getClassifier())); d.setSystemPath(interpolate(dict, d.getSystemPath())); for (Exclusion e: d.getExclusions()) { e.setGroupId(interpolate(dict, e.getGroupId())); e.setArtifactId(interpolate(dict, e.getArtifactId())); } } }
private static void interpolate(Map<String, String> dict, Iterable<Dependency> dependencies) { if (dependencies == null) { return; } for (Dependency d: dependencies) { d.setGroupId(interpolate(dict, d.getGroupId())); d.setArtifactId(interpolate(dict, d.getArtifactId())); d.setVersion(interpolate(dict, d.getVersion())); d.setClassifier(interpolate(dict, d.getClassifier())); d.setSystemPath(interpolate(dict, d.getSystemPath())); for (Exclusion e: d.getExclusions()) { e.setGroupId(interpolate(dict, e.getGroupId())); e.setArtifactId(interpolate(dict, e.getArtifactId())); } } }
@Test public void testTheResolutionWhenATransitiveDependencyIsMissingButOptional() { File local = new File("target/test-repos/incomplete"); new LocalRepoBuilder(local).addArtifact(new LocalArtifact("org.acme", "acme", "1.0").generateMainArtifact() .addDependency(new LocalDependency("org.acme", "acme-missing", "1.0").optional(true))).build(); Exclusion exclusion = new Exclusion(); exclusion.setArtifactId("acme-missing"); exclusion.setGroupId("org.acme"); Dependency dependency = new Dependency("org.acme", "acme", "1.0", "txt"); Stack stack = new Stack() .addDependency(new Dependency("io.vertx", "vertx-core", "3.1.0")) .addDependency(dependency); StackResolutionOptions options = new StackResolutionOptions().setFailOnConflicts(true) .setLocalRepository(local.getAbsolutePath()); StackResolution resolution = new StackResolution(stack, root, options); Map<String, File> map = resolution.resolve(); assertThat(map).containsKey("io.vertx:vertx-core:jar:3.1.0"); assertThat(map).containsKey("org.acme:acme:txt:1.0"); }
@Test public void testTheResolutionWhenATransitiveDependencyIsMissingButOptional() { File local = new File("target/test-repos/incomplete"); new LocalRepoBuilder(local).addArtifact(new LocalArtifact("org.acme", "acme", "1.0").generateMainArtifact() .addDependency(new LocalDependency("org.acme", "acme-missing", "1.0").optional(true))).build(); Exclusion exclusion = new Exclusion(); exclusion.setArtifactId("acme-missing"); exclusion.setGroupId("org.acme"); Dependency dependency = new Dependency("org.acme", "acme", "1.0", "txt"); Stack stack = new Stack() .addDependency(new Dependency("io.vertx", "vertx-core", "3.1.0")) .addDependency(dependency); StackResolutionOptions options = new StackResolutionOptions().setFailOnConflicts(true) .setLocalRepository(local.getAbsolutePath()); StackResolution resolution = new StackResolution(stack, root, options); Map<String, File> map = resolution.resolve(); assertThat(map).containsKey("io.vertx:vertx-core:jar:3.1.0"); assertThat(map).containsKey("org.acme:acme:txt:1.0"); }