本文整理汇总了Java中org.jboss.forge.addon.dependencies.builder.DependencyBuilder类的典型用法代码示例。如果您正苦于以下问题:Java DependencyBuilder类的具体用法?Java DependencyBuilder怎么用?Java DependencyBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DependencyBuilder类属于org.jboss.forge.addon.dependencies.builder包,在下文中一共展示了DependencyBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ensureCamelArtifactIdAdded
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
public static Result ensureCamelArtifactIdAdded(Project project, CamelComponentDetails details, DependencyInstaller dependencyInstaller) {
String groupId = details.getGroupId();
String artifactId = details.getArtifactId();
Dependency core = CamelProjectHelper.findCamelCoreDependency(project);
if (core == null) {
return Results.fail("The project does not include camel-core");
}
// we want to use same version as camel-core if its a camel component
// otherwise use the version from the dto
String version;
if ("org.apache.camel".equals(groupId)) {
version = core.getCoordinate().getVersion();
} else {
version = details.getVersion();
}
DependencyBuilder component = DependencyBuilder.create().setGroupId(groupId)
.setArtifactId(artifactId).setVersion(version);
// install the component
dependencyInstaller.install(project, component);
return null;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:24,代码来源:CamelCommandsHelper.java
示例2: addDependencies
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
protected void addDependencies() {
Parent p = new Parent();
p.setGroupId(GRIFFON_GROUP_ID);
p.setArtifactId(GRIFFON_MASTERPOM_ARTIFACT_ID);
p.setVersion("1.0.0");
MavenFacet mavenFacet = getFaceted().getFacet(MavenFacet.class);
Model model = mavenFacet.getModel();
model.setParent(p);
mavenFacet.setModel(model);
DependencyFacet facet = getFaceted().getFacet(DependencyFacet.class);
facet.addRepository("jcenter","http://jcenter.bintray.com");
facet.addRepository("griffon-plugins","http://dl.bintray.com/griffon/griffon-plugins");
MetadataFacet mdfacet = getFaceted().getFacet(MetadataFacet.class);
mdfacet.setDirectProperty("griffon.version","2.2.0");
mdfacet.setDirectProperty("application.main.class",mdfacet.getProjectGroupName()+".Launcher");
mdfacet.setDirectProperty("maven.compiler.source","1.8");
mdfacet.setDirectProperty("maven.compiler.target","1.8");
builder = DependencyBuilder.create();
addDependency(LOG4J);
addDependency(SLF4J_LOG4J12);
addDependency(SPOCK_CORE);
addDependency(JUNIT);
}
开发者ID:jughyd,项目名称:griffon-forge-addon,代码行数:27,代码来源:AbstractGriffonFacet.java
示例3: addDependency
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
public static DependencyBuilder addDependency(Project project, Dependency dependency) {
final DependencyFacet dependencyFacet = project.getFacet(DependencyFacet.class);
final DependencyBuilder builder = dependency instanceof DependencyBuilder
? (DependencyBuilder) dependency : DependencyBuilder.create(dependency);
dependencyFacet.addDirectDependency(builder);
return builder;
}
开发者ID:forge,项目名称:springboot-addon,代码行数:10,代码来源:SpringBootHelper.java
示例4: addFabric8DependenciesToPom
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
private void addFabric8DependenciesToPom(Project project, String fabric8Deps, Map<String, SpringBootDependencyDTO> selectedDTOs) {
String[] deps = fabric8Deps.split(",");
for (String dep : deps) {
SpringBootDependencyDTO dto = selectedDTOs.get(dep);
if (dto != null) {
DependencyBuilder dp = DependencyBuilder.create().setGroupId(dto.getGroupId()).setArtifactId(dto.getArtifactId()).setVersion(dto.getVersion());
dependencyInstaller.install(project, dp);
}
}
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:11,代码来源:SpringBootNewProjectCommand.java
示例5: ensureMavenDependencyAdded
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
/**
* Returns true if the dependency was added or false if its already there
*/
public static boolean ensureMavenDependencyAdded(Project project, DependencyInstaller dependencyInstaller, String groupId, String artifactId, String scope) {
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
for (Dependency d : dependencies) {
if (groupId.equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) {
getLOG().debug("Project already includes: " + groupId + ":" + artifactId + " for version: " + d.getCoordinate().getVersion());
return false;
}
}
DependencyBuilder component = DependencyBuilder.create().
setGroupId(groupId).
setArtifactId(artifactId);
if (scope != null) {
component.setScopeType(scope);
}
String version = MavenHelpers.getVersion(groupId, artifactId);
if (Strings.isNotBlank(version)) {
component = component.setVersion(version);
getLOG().debug("Adding pom.xml dependency: " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope);
} else {
getLOG().debug("No version could be found for: " + groupId + ":" + artifactId);
}
dependencyInstaller.install(project, component);
return true;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:31,代码来源:MavenHelpers.java
示例6: getOrAddDependency
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
public static Dependency getOrAddDependency(Project project, String groupId, String artifactId,
String version, String classifier, String scope) {
DependencyFacet dependencies = project.getFacet(DependencyFacet.class);
Optional<Dependency> found = dependencies.getEffectiveDependencies().stream().filter(dep ->
dep.getCoordinate().getGroupId().equalsIgnoreCase(groupId)
&& dep.getCoordinate().getArtifactId().equalsIgnoreCase(artifactId)
&& (version == null || version.equalsIgnoreCase(dep.getCoordinate().getVersion()))
&& Strings.isNullOrEmpty(dep.getCoordinate().getClassifier())
&& (Strings.isNullOrEmpty(dep.getCoordinate().getPackaging()) || dep.getCoordinate().getPackaging()
.equalsIgnoreCase("jar"))
).findAny();
if (found.isPresent()) {
return found.get();
}
DependencyBuilder dependency = DependencyBuilder.create().setGroupId(groupId).setArtifactId(artifactId);
if (version != null) {
dependency.setVersion(version);
}
if (scope != null) {
dependency.setScopeType(scope);
}
if (classifier != null && ! classifier.isEmpty()) {
dependency.setClassifier(classifier);
}
dependencies.addDirectDependency(dependency);
return dependency;
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:31,代码来源:ForgeUtils.java
示例7: addVertxBom
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
private void addVertxBom() {
DependencyBuilder dependency = DependencyBuilder.create()
.setGroupId("io.vertx")
.setArtifactId("vertx-dependencies")
.setVersion("${" + VERTX_VERSION_PROPERTY + "}")
.setScopeType("import")
.setPackaging("pom");
DependencyFacet facet = getDependencyFacet();
facet.addManagedDependency(dependency);
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:11,代码来源:VertxMavenFacet.java
示例8: testOnProjectThatHasAlreadyDependencies
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Test
public void testOnProjectThatHasAlreadyDependencies() throws Exception {
File root = prepareRoot("target/tests/project-with-dependencies");
Project project = projectFactory.createProject(resourceFactory.create(root), projectProvider);
DependencyFacet dependencies = project.getFacet(DependencyFacet.class);
dependencies.addDirectDependency(DependencyBuilder.create("commons-io:commons-io:2.4"));
checkDependency(dependencies, "commons-io", "commons-io", "2.4", null);
facetFactory.install(project, VertxMavenFacet.class);
MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
MavenFacet maven = project.getFacet(MavenFacet.class);
// Check vertx.version
assertThat(maven.getProperties()).contains(entry(VertxMavenFacet.VERTX_VERSION_PROPERTY, config().getVersion()));
// Check managed dependency
checkVertxBom(dependencies);
assertThat(dependencies.getManagedDependencies()).hasSize(1);
// Check dependencies
checkDependency(dependencies, "commons-io", "commons-io", "2.4", null);
checkDependency(dependencies, "io.vertx", "vertx-core", null, null);
checkDependency(dependencies, "io.vertx", "vertx-unit", null, "test");
checkDependency(dependencies, "junit", "junit", "4.12", "test");
assertThat(dependencies.getDependencies()).hasSize(4);
// Check maven compiler
hasPlugin(plugins, "maven-compiler-plugin");
hasPlugin(plugins, "vertx-maven-plugin");
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:32,代码来源:VertxFacetTest.java
示例9: testOnProjectThatHasAlreadyACoreDependency
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Test
public void testOnProjectThatHasAlreadyACoreDependency() throws Exception {
File root = prepareRoot("target/tests/project-with-core-dependency");
Project project = projectFactory.createProject(resourceFactory.create(root), projectProvider);
DependencyFacet dependencies = project.getFacet(DependencyFacet.class);
dependencies.addDirectDependency(DependencyBuilder.create("io.vertx:vertx-core:3.1.0"));
checkDependency(dependencies, "io.vertx", "vertx-core", "3.1.0", null);
facetFactory.install(project, VertxMavenFacet.class);
MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
MavenFacet maven = project.getFacet(MavenFacet.class);
// Check vertx.version
assertThat(maven.getProperties()).contains(entry(VertxMavenFacet.VERTX_VERSION_PROPERTY, config().getVersion()));
// Check managed dependency
checkVertxBom(dependencies);
assertThat(dependencies.getManagedDependencies()).hasSize(1);
// Check dependencies
checkDependency(dependencies, "io.vertx", "vertx-core", "3.1.0", null);
checkDependency(dependencies, "io.vertx", "vertx-unit", null, "test");
checkDependency(dependencies, "junit", "junit", "4.12", "test");
assertThat(dependencies.getDependencies()).hasSize(3);
// Check maven compiler
hasPlugin(plugins, "maven-compiler-plugin");
hasPlugin(plugins, "vertx-maven-plugin");
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:31,代码来源:VertxFacetTest.java
示例10: testOnProjectThatHasAlreadyABomDependency
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Test
public void testOnProjectThatHasAlreadyABomDependency() throws Exception {
File root = prepareRoot("target/tests/project-with-managed-dependency");
Project project = projectFactory.createProject(resourceFactory.create(root), projectProvider);
DependencyFacet dependencies = project.getFacet(DependencyFacet.class);
dependencies.addManagedDependency(DependencyBuilder.create("org.jboss.forge:forge-bom:2.20.1.Final")
.setScopeType("import").setPackaging("pom"));
facetFactory.install(project, VertxMavenFacet.class);
MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
MavenFacet maven = project.getFacet(MavenFacet.class);
// Check vertx.version
assertThat(maven.getProperties()).contains(entry(VertxMavenFacet.VERTX_VERSION_PROPERTY, config().getVersion()));
// Check managed dependency
checkVertxBom(dependencies);
assertThat(dependencies.getManagedDependencies()).hasSize(2);
// Check dependencies
checkDependency(dependencies, "io.vertx", "vertx-core", null, null);
checkDependency(dependencies, "io.vertx", "vertx-unit", null, "test");
checkDependency(dependencies, "junit", "junit", "4.12", "test");
assertThat(dependencies.getDependencies()).hasSize(3);
// Check maven compiler
hasPlugin(plugins, "maven-compiler-plugin");
hasPlugin(plugins, "vertx-maven-plugin");
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:31,代码来源:VertxFacetTest.java
示例11: testOnProjectThatHasTheBomAlready
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Test
public void testOnProjectThatHasTheBomAlready() throws Exception {
File root = prepareRoot("target/tests/project-with-managed-dependency");
Project project = projectFactory.createProject(resourceFactory.create(root), projectProvider);
DependencyFacet dependencies = project.getFacet(DependencyFacet.class);
dependencies.addManagedDependency(DependencyBuilder.create("io.vertx:vertx-dependencies:3.3.0")
.setScopeType("import").setPackaging("pom"));
dependencies.addDirectDependency(DependencyBuilder.create("io.vertx:vertx-core"));
facetFactory.install(project, VertxMavenFacet.class);
MavenPluginFacet plugins = project.getFacet(MavenPluginFacet.class);
MavenFacet maven = project.getFacet(MavenFacet.class);
// Check vertx.version
assertThat(maven.getProperties()).contains(entry(VertxMavenFacet.VERTX_VERSION_PROPERTY, config().getVersion()));
// Check managed dependency
checkVertxBom(dependencies);
assertThat(dependencies.getManagedDependencies()).hasSize(1);
// Check dependencies
checkDependency(dependencies, "io.vertx", "vertx-core", null, null);
checkDependency(dependencies, "io.vertx", "vertx-unit", null, "test");
checkDependency(dependencies, "junit", "junit", "4.12", "test");
assertThat(dependencies.getDependencies()).hasSize(3);
// Check maven compiler
hasPlugin(plugins, "maven-compiler-plugin");
hasPlugin(plugins, "vertx-maven-plugin");
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:32,代码来源:VertxFacetTest.java
示例12: addCustomComponent
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
private Set<String> addCustomComponent(Project project, String g, String a, String v) throws Exception {
// download the JAR and look inside to find its javaType so we can add it to the catalog
DependencyBuilder component = DependencyBuilder.create()
.setGroupId(g).setArtifactId(a).setVersion(v);
Dependency dependency = dependencyInstaller.install(project, component);
if (dependency == null) {
return null;
}
return discoverCustomCamelComponentsOnClasspathAndAddToCatalog(camelCatalog, project);
}
开发者ID:fabric8io,项目名称:django,代码行数:13,代码来源:ConnectorSelectComponentStep.java
示例13: execute
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
ConnectionCatalogDto dto = connectors.getValue();
Project project = getSelectedProject(context);
// install connector as dependency
if (!hasDependency(project, dto.getGroupId(), dto.getArtifactId(), dto.getVersion())) {
DependencyBuilder component = DependencyBuilder.create().setGroupId(dto.getGroupId())
.setArtifactId(dto.getArtifactId()).setVersion(dto.getVersion());
dependencyInstaller.install(project, component);
}
return Results.success("Added connector " + dto.getName());
}
开发者ID:fabric8io,项目名称:django,代码行数:16,代码来源:ConnectorSelectStep.java
示例14: createLiquibaseDependency
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
private DependencyBuilder createLiquibaseDependency()
{
return DependencyBuilder.create()
.setGroupId("org.liquibase")
.setArtifactId("liquibase-maven-plugin")
.setVersion(Constants.LIQUIBASE_DEFAULT_VERSION)
.setPackaging("pom")
.setScopeType("provided");
}
开发者ID:forge,项目名称:db-migration-addon,代码行数:10,代码来源:DatabaseMigrationFacetImpl.java
示例15: testAddLiquibaseSetup
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Test
public void testAddLiquibaseSetup() throws Exception
{
try (CommandController commandController = testHarness.createCommandController(AddLiquibaseCommand.class,
project.getRoot()))
{
commandController.initialize();
commandController.setValueFor("liquibaseVersion", Constants.LIQUIBASE_DEFAULT_VERSION);
Assert.assertTrue(commandController.isValid());
Result result = commandController.execute();
Assert.assertTrue(project.getFacet(ResourcesFacet.class).getResourceDirectory()
.getChildDirectory(Constants.MIGRATION_DIRECTORY_NAME).exists());
DependencyFacet depFacet = project.getFacet(DependencyFacet.class);
Assert.assertTrue(depFacet.hasDirectManagedDependency(DependencyBuilder.create()
.setGroupId("org.liquibase")
.setArtifactId("liquibase-maven-plugin")
.setVersion(Constants.LIQUIBASE_DEFAULT_VERSION)
.setPackaging("pom")
.setScopeType("provided")));
MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
Assert.assertEquals(metadataFacet.getDirectProperty(Constants.LIQUIBASE_VERSION_PROPERTY_NAME),
Constants.LIQUIBASE_DEFAULT_VERSION);
}
}
开发者ID:forge,项目名称:db-migration-addon,代码行数:29,代码来源:AddLiquibaseCommandTest.java
示例16: installFractions
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
public void installFractions(Iterable<FractionDescriptor> selectedFractions)
{
DependencyFacet facet = getFaceted().getFacet(DependencyFacet.class);
addSwarmBOM();
for (FractionDescriptor descriptor : selectedFractions)
{
Dependency dependency = DependencyBuilder.create()
.setGroupId(descriptor.getGroupId())
.setArtifactId(descriptor.getArtifactId());
if (!facet.hasEffectiveDependency(dependency))
{
facet.addDirectDependency(dependency);
}
}
}
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:16,代码来源:WildFlySwarmFacet.java
示例17: addSpringBootDependency
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
public static DependencyBuilder addSpringBootDependency(Project project, String artifactId) {
return addDependency(project, SpringBootFacet.SPRING_BOOT_GROUP_ID, artifactId);
}
开发者ID:forge,项目名称:springboot-addon,代码行数:4,代码来源:SpringBootHelper.java
示例18: execute
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
Project project = getSelectedProject(context);
// does the project already have camel?
Dependency core = findCamelCoreDependency(project);
if (core == null) {
return Results.fail("The project does not include camel-core");
}
String name = languageName.getValue();
LanguageDto dto = findLanguateDto(name);
if (dto != null) {
// we want to use same version as camel-core if its a camel component
// otherwise use the version from the dto
String version;
if ("org.apache.camel".equals(dto.getGroupId())) {
version = core.getCoordinate().getVersion();
} else {
version = dto.getVersion();
}
String artifactId = dto.getArtifactId();
// is it spring boot project and Camel is > 2.18.0 then we must use -starter
if (isSpringBootProject(project)) {
boolean newer = CamelVersionHelper.isGE("2.18.0", version);
if (newer) {
artifactId = artifactId + "-starter";
}
}
DependencyBuilder dependency = DependencyBuilder.create().setGroupId(dto.getGroupId())
.setArtifactId(artifactId).setVersion(version);
// install the component
dependencyInstaller.install(project, dependency);
return Results.success("Added Camel language " + dto.getName() + " (" + dto.getArtifactId() + ") to the project");
} else {
return Results.fail("Unknown Camel language");
}
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:46,代码来源:CamelProjectAddLanguageCommand.java
示例19: execute
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
Project project = getSelectedProject(context);
// does the project already have camel?
Dependency core = findCamelCoreDependency(project);
if (core == null) {
return Results.fail("The project does not include camel-core");
}
ComponentDto dto = componentName.getValue();
if (dto != null) {
// we want to use same version as camel-core if its a camel component
// otherwise use the version from the dto
String version;
if ("org.apache.camel".equals(dto.getGroupId())) {
version = core.getCoordinate().getVersion();
} else {
version = dto.getVersion();
}
String artifactId = dto.getArtifactId();
// is it spring boot project and Camel is > 2.18.0 then we must use -starter
if (isSpringBootProject(project)) {
boolean newer = CamelVersionHelper.isGE("2.18.0", version);
if (newer) {
artifactId = artifactId + "-starter";
}
}
DependencyBuilder dependency = DependencyBuilder.create().setGroupId(dto.getGroupId())
.setArtifactId(artifactId).setVersion(version);
// install the component
dependencyInstaller.install(project, dependency);
return Results.success("Added Camel component " + dto.getScheme() + " (" + dto.getArtifactId() + ") to the project");
} else {
return Results.fail("Unknown Camel component");
}
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:44,代码来源:CamelProjectAddComponentStep.java
示例20: execute
import org.jboss.forge.addon.dependencies.builder.DependencyBuilder; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
Project project = getSelectedProject(context);
// does the project already have camel?
Dependency core = findCamelCoreDependency(project);
if (core == null) {
return Results.fail("The project does not include camel-core");
}
String name = dataformatName.getValue();
DataFormatDto dto = findDataFormatDto(name);
if (dto != null) {
// we want to use same version as camel-core if its a camel component
// otherwise use the version from the dto
String version;
if ("org.apache.camel".equals(dto.getGroupId())) {
version = core.getCoordinate().getVersion();
} else {
version = dto.getVersion();
}
String artifactId = dto.getArtifactId();
// is it spring boot project and Camel is > 2.18.0 then we must use -starter
if (isSpringBootProject(project)) {
boolean newer = CamelVersionHelper.isGE("2.18.0", version);
if (newer) {
artifactId = artifactId + "-starter";
}
}
DependencyBuilder dependency = DependencyBuilder.create().setGroupId(dto.getGroupId())
.setArtifactId(artifactId).setVersion(version);
// install the component
dependencyInstaller.install(project, dependency);
return Results.success("Added Camel dataformat " + dto.getName() + " (" + dto.getArtifactId() + ") to the project");
} else {
return Results.fail("Unknown Camel dataformat");
}
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:47,代码来源:CamelProjectAddDataFormatCommand.java
注:本文中的org.jboss.forge.addon.dependencies.builder.DependencyBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论