本文整理汇总了Java中org.jboss.forge.addon.projects.facets.DependencyFacet类的典型用法代码示例。如果您正苦于以下问题:Java DependencyFacet类的具体用法?Java DependencyFacet怎么用?Java DependencyFacet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DependencyFacet类属于org.jboss.forge.addon.projects.facets包,在下文中一共展示了DependencyFacet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: hasDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
public static boolean hasDependency(Project project, String groupId, String artifactId, String version) {
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
for (Dependency d : dependencies) {
boolean match = d.getCoordinate().getGroupId().equals(groupId);
if (match && artifactId != null) {
match = d.getCoordinate().getArtifactId().equals(artifactId);
}
if (match && version != null) {
match = d.getCoordinate().getVersion().equals(version);
}
if (match) {
return match;
}
}
return false;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:CamelProjectHelper.java
示例2: hasManagedDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
public static boolean hasManagedDependency(Project project, String groupId, String artifactId, String version) {
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getManagedDependencies();
for (Dependency d : dependencies) {
boolean match = d.getCoordinate().getGroupId().equals(groupId);
if (match && artifactId != null) {
match = d.getCoordinate().getArtifactId().equals(artifactId);
}
if (match && version != null) {
match = d.getCoordinate().getVersion().equals(version);
}
if (match) {
return match;
}
}
return false;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:CamelProjectHelper.java
示例3: testOnEmptyProject
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
@Test
public void testOnEmptyProject() throws Exception {
Project project = projectFactory.createTempProject(projectProvider);
facetFactory.install(project, VertxMavenFacet.class);
DependencyFacet dependencies = project.getFacet(DependencyFacet.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,代码行数:27,代码来源:VertxFacetTest.java
示例4: testOnProjectDefiningVertxVersion
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
/**
* If the project define vertx.version, the facet is considered as already installed.
*
* @throws Exception something failed
*/
@Test
public void testOnProjectDefiningVertxVersion() throws Exception {
File root = prepareRoot("target/tests/project-defining-vertx-version");
Project project = projectFactory.createProject(resourceFactory.create(root), projectProvider);
MavenFacet maven = project.getFacet(MavenFacet.class);
ForgeUtils.addPropertyToProject(project, VertxMavenFacet.VERTX_VERSION_PROPERTY, "3.1.0");
DependencyFacet dependencies = project.getFacet(DependencyFacet.class);
facetFactory.install(project, VertxMavenFacet.class);
assertThat(project.hasFacet(VertxMavenFacet.class)).isTrue();
assertThat(maven.getProperties()).contains(entry(VertxMavenFacet.VERTX_VERSION_PROPERTY, "3.1.0"));
assertThat(dependencies.getManagedDependencies()).hasSize(0);
assertThat(dependencies.getDependencies()).hasSize(0);
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:21,代码来源:VertxFacetTest.java
示例5: checkDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
public void checkDependency(DependencyFacet dependencies, String groupId, String artifactId, String version, String
scope) {
Optional<Dependency> dep = dependencies.getDependencies().stream().filter((dependency) ->
dependency.getCoordinate().getArtifactId().equals(artifactId))
.findFirst();
assertThat(dep.isPresent()).isTrue();
assertThat(dep.get().getCoordinate().getGroupId()).isEqualTo(groupId);
if (version == null) {
assertThat(dep.get().getCoordinate().getVersion()).isNull();
} else {
assertThat(dep.get().getCoordinate().getVersion()).isEqualTo(version);
}
if (scope != null) {
assertThat(dep.get().getScopeType()).isEqualTo(scope);
}
}
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:17,代码来源:VertxFacetTest.java
示例6: execute
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
Project project = getSelectedProject(context);
final DependencyFacet dependencyFacet = project.getFacet(DependencyFacet.class);
if (!isArquillianWildflySwarmDependencyInstalled(dependencyFacet)) {
installArquillianWildflySwarmDependency(dependencyFacet);
}
JavaClassSource test = Roaster.create(JavaClassSource.class)
.setPackage(targetPackage.getValue())
.setName(named.getValue());
addArquillianRunner(test);
addDefaultDeploymentAnnotation(test, project);
addArquillianResourceEnricher(test);
addTestMethod(test);
JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
facet.saveTestJavaSource(test);
return Results.success(String.format("Test Class %s.%s was created", targetPackage.getValue(), named.getValue()));
}
开发者ID:forge,项目名称:wildfly-swarm-addon,代码行数:24,代码来源:CreateTestClassCommand.java
示例7: addDependencies
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例8: execute
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception
{
final Result result = original.execute(context);
final Project project = helper.getProject(context.getUIContext());
final DependencyFacet facet = project.getFacet(DependencyFacet.class);
// add dependencies
facet.addDirectDependency(SpringBootFacet.SPRING_BOOT_STARTER_WEB);
facet.addDirectDependency(SpringBootFacet.CXF_SPRING_BOOT);
facet.addDirectDependency(SpringBootFacet.JACKSON_JAXRS_PROVIDER);
// remove EE dependencies
facet.removeDependency(SpringBootFacet.JBOSS_EJB_SPEC);
facet.removeDependency(SpringBootFacet.JBOSS_JAXRS_SPEC);
facet.removeDependency(SpringBootFacet.JBOSS_SERVLET_SPEC);
facet.removeManagedDependency(SpringBootFacet.JBOSS_EE_SPEC);
// add CXF properties to application.properties
final Properties cxfProps = new Properties();
cxfProps.put("cxf.jaxrs.component-scan", "true");
cxfProps.put("cxf.path", "/rest");
SpringBootHelper.writeToApplicationProperties(project, cxfProps);
SpringBootHelper.modifySpringBootApplication(project, sbApp -> {
sbApp.addImport("com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider");
final MethodSource<JavaClassSource> method = sbApp.addMethod("public JacksonJsonProvider config() {\n" +
"\t\treturn new JacksonJsonProvider();\n" +
"\t}");
method.addAnnotation("org.springframework.context.annotation.Bean");
return sbApp;
});
return result;
}
开发者ID:forge,项目名称:springboot-addon,代码行数:39,代码来源:RestGenerateFromEntitiesCommand.java
示例9: addDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例10: getRequiredFacets
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
@Override
public Iterable<Class<? extends ProjectFacet>> getRequiredFacets() {
List<Class<? extends ProjectFacet>> result = new ArrayList<Class<? extends ProjectFacet>>(7);
result.add(MetadataFacet.class);
result.add(PackagingFacet.class);
result.add(DependencyFacet.class);
result.add(ResourcesFacet.class);
result.add(WebResourcesFacet.class);
result.add(JavaSourceFacet.class);
result.add(JavaCompilerFacet.class);
return result;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:FunktionProjectType.java
示例11: findCamelArtifactDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
public static Dependency findCamelArtifactDependency(Project project, String artifactId) {
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
for (Dependency d : dependencies) {
if ("org.apache.camel".equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) {
return d;
}
}
return null;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:10,代码来源:CamelProjectHelper.java
示例12: findCamelArtifacts
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
public static Set<Dependency> findCamelArtifacts(Project project) {
Set<Dependency> answer = new LinkedHashSet<Dependency>();
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
for (Dependency d : dependencies) {
if ("org.apache.camel".equals(d.getCoordinate().getGroupId())) {
answer.add(d);
}
}
return answer;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:12,代码来源:CamelProjectHelper.java
示例13: findCustomCamelArtifacts
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的package包/类
public static Set<Dependency> findCustomCamelArtifacts(Project project) {
Set<Dependency> answer = new LinkedHashSet<Dependency>();
List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
for (Dependency d : dependencies) {
if (isCamelComponentArtifact(d)) {
answer.add(d);
}
}
return answer;
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:12,代码来源:CamelProjectHelper.java
示例14: ensureMavenDependencyAdded
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例15: getOrAddDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例16: addVertxBom
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例17: testOnProjectThatHasAlreadyDependencies
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例18: testOnProjectThatHasAlreadyACoreDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例19: testOnProjectThatHasAlreadyABomDependency
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
示例20: testOnProjectThatHasTheBomAlready
import org.jboss.forge.addon.projects.facets.DependencyFacet; //导入依赖的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
注:本文中的org.jboss.forge.addon.projects.facets.DependencyFacet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论