本文整理汇总了Java中org.apache.maven.model.Exclusion.setGroupId方法的典型用法代码示例。如果您正苦于以下问题:Java Exclusion.setGroupId方法的具体用法?Java Exclusion.setGroupId怎么用?Java Exclusion.setGroupId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Exclusion
的用法示例。
在下文中一共展示了Exclusion.setGroupId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDependency
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
private void addDependency(MavenDependencyInternal dependency, String artifactId, String scope, String type, String classifier) {
Dependency mavenDependency = new Dependency();
mavenDependency.setGroupId(dependency.getGroupId());
mavenDependency.setArtifactId(artifactId);
mavenDependency.setVersion(mapToMavenSyntax(dependency.getVersion()));
mavenDependency.setType(type);
mavenDependency.setScope(scope);
mavenDependency.setClassifier(classifier);
for (ExcludeRule excludeRule : dependency.getExcludeRules()) {
Exclusion exclusion = new Exclusion();
exclusion.setGroupId(GUtil.elvis(excludeRule.getGroup(), "*"));
exclusion.setArtifactId(GUtil.elvis(excludeRule.getModule(), "*"));
mavenDependency.addExclusion(exclusion);
}
getModel().addDependency(mavenDependency);
}
示例2: resolve
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
protected Dependency resolve(Dependency rawDep) {
Dependency dep = new Dependency();
dep.setGroupId(substituteProperties(rawDep.getGroupId()));
dep.setArtifactId(substituteProperties(rawDep.getArtifactId()));
dep.setVersion(substituteProperties(rawDep.getVersion()));
dep.setScope(substituteProperties(rawDep.getScope()));
dep.setSystemPath(substituteProperties(rawDep.getSystemPath()));
dep.setClassifier(substituteProperties(rawDep.getClassifier()));
dep.setType(substituteProperties(rawDep.getType()));
dep.setOptional(substituteProperties(rawDep.getOptional()));
if (rawDep.getExclusions() != null) {
List<Exclusion> exclusions = new ArrayList<>(rawDep.getExclusions().size());
for (Exclusion rawEx : rawDep.getExclusions()) {
Exclusion ex = new Exclusion();
ex.setArtifactId(substituteProperties(rawEx.getArtifactId()));
ex.setGroupId(substituteProperties(rawEx.getGroupId()));
exclusions.add(ex);
}
dep.setExclusions(exclusions);
}
return dep;
}
示例3: addDependency
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
private void addDependency(MavenDependencyInternal dependency, String artifactId, String scope, String type, String classifier) {
Dependency mavenDependency = new Dependency();
mavenDependency.setGroupId(dependency.getGroupId());
mavenDependency.setArtifactId(artifactId);
mavenDependency.setVersion(dependency.getVersion());
mavenDependency.setType(type);
mavenDependency.setScope(scope);
mavenDependency.setClassifier(classifier);
for (ExcludeRule excludeRule : dependency.getExcludeRules()) {
Exclusion exclusion = new Exclusion();
exclusion.setGroupId(GUtil.elvis(excludeRule.getGroup(), "*"));
exclusion.setArtifactId(GUtil.elvis(excludeRule.getModule(), "*"));
mavenDependency.addExclusion(exclusion);
}
getModel().addDependency(mavenDependency);
}
示例4: toMavenDependency
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
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;
}
示例5: interpolate
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
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()));
}
}
}
示例6: testConflictManagementUsingExclusions
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
@Test
public void testConflictManagementUsingExclusions() {
Dependency dependency = new Dependency("io.vertx", "vertx-core", "3.1.0");
Exclusion exclusion1 = new Exclusion();
exclusion1.setGroupId("com.fasterxml.jackson.core");
exclusion1.setArtifactId("jackson-databind");
Exclusion exclusion2 = new Exclusion();
exclusion2.setGroupId("com.fasterxml.jackson.core");
exclusion2.setArtifactId("jackson-core");
dependency.addExclusion(exclusion1);
dependency.addExclusion(exclusion2);
Stack stack = new Stack()
.addDependency(dependency)
// Not the version used by vert.x
.addDependency(new Dependency("com.fasterxml.jackson.core", "jackson-databind", "2.4.1.3"));
StackResolution resolution = new StackResolution(stack, root, STRICT);
resolution.resolve();
Map<String, File> map = resolution.resolve();
assertThat(map).containsKey("io.vertx:vertx-core:jar:3.1.0");
assertThat(map).containsKey("com.fasterxml.jackson.core:jackson-databind:jar:2.4.1.3");
}
示例7: testTheResolutionWhenATransitiveDependencyIsMissingButExcluded
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
@Test
public void testTheResolutionWhenATransitiveDependencyIsMissingButExcluded() {
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"))).build();
Exclusion exclusion = new Exclusion();
exclusion.setArtifactId("acme-missing");
exclusion.setGroupId("org.acme");
Dependency dependency = new Dependency("org.acme", "acme", "1.0", "txt");
dependency.addExclusion(exclusion);
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");
}
示例8: testTheResolutionWhenATransitiveDependencyIsMissingButOptional
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
@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");
}
示例9: convert
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
public Exclusion convert(ExcludeRule excludeRule) {
if (isConvertable(excludeRule)) {
Exclusion exclusion = new Exclusion();
exclusion.setGroupId(determineExclusionExpression(excludeRule.getGroup()));
exclusion.setArtifactId(determineExclusionExpression(excludeRule.getModule()));
return exclusion;
}
return null;
}
示例10: createDependencyFromCoordinates
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
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;
}
示例11: ExclusionWrapper
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
public ExclusionWrapper(final String groupId, final String artifactId) {
exclusion = new Exclusion();
exclusion.setArtifactId(artifactId);
exclusion.setGroupId(groupId);
this.groupId = groupId;
this.artifactId = artifactId;
}
示例12: addExclusionsForKafka
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
public static void addExclusionsForKafka(Model pomModel) throws IOException {
List<Dependency> dependencies = pomModel.getDependencies();
CopyOnWriteArrayList<Dependency> cowal = new CopyOnWriteArrayList<>(dependencies);
for (Dependency dep : cowal) {
if (dep.getArtifactId().startsWith("kafka_")) {
pomModel.removeDependency(dep);
Exclusion exclusion = new Exclusion();
exclusion.setArtifactId("slf4j-log4j12");
exclusion.setGroupId("org.slf4j");
dep.addExclusion(exclusion);
pomModel.addDependency(dep);
}
}
}
示例13: convert
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
public Exclusion convert(ExcludeRule excludeRule) {
if (isConvertable(excludeRule)) {
Exclusion exclusion = new Exclusion();
exclusion.setGroupId(excludeRule.getGroup());
exclusion.setArtifactId(excludeRule.getModule());
return exclusion;
}
return null;
}
示例14: mergeExclusion_GroupId
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
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" ) );
}
}
}
示例15: exclude
import org.apache.maven.model.Exclusion; //导入方法依赖的package包/类
public DependencyBuilder exclude(Model m) {
Exclusion exclusion = new Exclusion();
exclusion.setArtifactId(m.getArtifactId());
exclusion.setGroupId(m.getGroupId());
dependency.addExclusion(exclusion);
return this;
}