• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Maven类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中hudson.tasks.Maven的典型用法代码示例。如果您正苦于以下问题:Java Maven类的具体用法?Java Maven怎么用?Java Maven使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Maven类属于hudson.tasks包,在下文中一共展示了Maven类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: build

import hudson.tasks.Maven; //导入依赖的package包/类
@Test public void build() throws Exception {
    Maven.MavenInstallation tool = ToolInstallations.configureMaven3();
    String name = tool.getName();
    Maven.MavenInstallation.DescriptorImpl desc = Jenkins.getInstance().getDescriptorByType(Maven.MavenInstallation.DescriptorImpl.class);

    // Defensive - Maven doesn't have a symbol before 2.x, and other tools may still not have symbols after that.
    String type = desc.getId();

    Set<String> symbols = SymbolLookup.getSymbolValue(desc);

    if (!symbols.isEmpty()) {
        type = symbols.iterator().next();
    }

    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition("node {def home = tool name: '" + name + "', type: '" + type + "'; def settings = readFile($/$home/conf/settings.xml/$).split(); echo settings[-1]}",
            true));

    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    r.assertLogContains("</settings>", b);
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("tool"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals(name, ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:25,代码来源:ToolStepTest.java


示例2: testTagTranslations

import hudson.tasks.Maven; //导入依赖的package包/类
@Test
public void testTagTranslations() throws Exception {
  YamlToJson underTest = new YamlToJson.Default(
      ImmutableList.<YamlTransform>of(
          new HelperTransform("!freestyle", FreeStyleProject.class),
          new HelperTransform("!maven", Maven.class),
          new HelperTransform("!git", GitSCM.class) {
            @Override
            public String construct(String value) {
              assertEquals("scm", value);
              return clazz.getName();
            }
          },
          new HelperTransform("!shell", Shell.class),
          new HelperTransform("!trigger", BuildTrigger.class),
          new HelperTransform("!mailer", Mailer.class)));
  for (String test : TAG_TESTS) {
    testOneTranslation(underTest, test);
  }
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:21,代码来源:YamlToJsonTest.java


示例3: testTagTranslations

import hudson.tasks.Maven; //导入依赖的package包/类
@Test
public void testTagTranslations() throws Exception {
  JsonToYaml underTest = new JsonToYaml.Default(
      ImmutableList.<YamlTransform>of(
          new HelperTransform("!freestyle", FreeStyleProject.class),
          new HelperTransform("!maven", Maven.class),
          new HelperTransform("!git", GitSCM.class) {
            @Override
            public String represent(Class clazz) {
              assertEquals(this.clazz, clazz);
              return "scm";
            }
            @Override
            public String construct(String value) {
              assertEquals("scm", value);
              return this.clazz.getName();
            }
          },
          new HelperTransform("!shell", Shell.class),
          new HelperTransform("!trigger", BuildTrigger.class),
          new HelperTransform("!mailer", Mailer.class)));
  for (String test : TAG_TESTS) {
    testOneTranslation(underTest, test);
  }
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:26,代码来源:JsonToYamlTest.java


示例4: getDetails_Maven

import hudson.tasks.Maven; //导入依赖的package包/类
@Test
public void getDetails_Maven() {
  Maven maven = new Maven("targets", "");
  assertEquals(maven.getTargets(), BuildStepDetailsProvider.resolveDetails(maven));
  // Check that Maven doesn't use "Invoke top-level Maven targets",
  // but instead uses our custom message.
  assertThat(maven.getDescriptor().getDisplayName())
      .isNotEqualTo(BuildStepDetailsProvider.resolveName(maven));
  assertEquals(Messages.BuildStepDetailsProvider_MavenName(),
      BuildStepDetailsProvider.resolveName(maven));
  assertEquals(ImmutableList.<String>of("mvn", "targets"),
      BuildStepDetailsProvider.resolveFullCmd(maven));
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:14,代码来源:BuildStepDetailsProviderTest.java


示例5: getDetails_noJenkins

import hudson.tasks.Maven; //导入依赖的package包/类
@Test
@WithoutJenkins
public void getDetails_noJenkins() {
  assertThat(BuildStepDetailsProvider.all()).isEmpty();
  assertNull(BuildStepDetailsProvider.resolveDetails(mock(Maven.class)));
  assertNull(BuildStepDetailsProvider.resolveName(mock(BuildStep.class)));
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:8,代码来源:BuildStepDetailsProviderTest.java


示例6: setup

import hudson.tasks.Maven; //导入依赖的package包/类
@Before
public void setup() throws Exception {
    // Maven.MavenInstallation maven3 = ToolInstallations.configureMaven35();
    Maven.MavenInstallation maven3 = ExtendedToolInstallations.configureMaven35();

    mavenInstallationName = maven3.getName();

    GlobalMavenConfig globalMavenConfig = jenkinsRule.get(GlobalMavenConfig.class);
    globalMavenConfig.setGlobalSettingsProvider(new DefaultGlobalSettingsProvider());
    globalMavenConfig.setSettingsProvider(new DefaultSettingsProvider());
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:12,代码来源:AbstractIntegrationTest.java


示例7: configureMaven35

import hudson.tasks.Maven; //导入依赖的package包/类
/**
 * Declare "Maven 3.5.0" as the "default" Maven installation in Jenkins and as the Maven installation named "apache-maven-3.5.0".
 * Note that both {@link hudson.tasks.Maven.MavenInstallation} share the same Maven binaries.
 *
 * @return the "apache-maven-3.5.0" Maven {@link hudson.tasks.Maven.MavenInstallation}
 * @throws Exception
 */
public static Maven.MavenInstallation configureMaven35() throws Exception {
    Maven.MavenInstallation mvn =  ToolInstallations.configureDefaultMaven("apache-maven-3.5.0", Maven.MavenInstallation.MAVEN_30);

    Maven.MavenInstallation maven350 = new Maven.MavenInstallation("apache-maven-3.5.0", mvn.getHome(), JenkinsRule.NO_PROPERTIES);
    Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven350);
    return maven350;
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:15,代码来源:ExtendedToolInstallations.java


示例8: testBindJob_FullJob

import hudson.tasks.Maven; //导入依赖的package包/类
@Test
public void testBindJob_FullJob() throws Exception {
  JSONObject json = (JSONObject) JSONSerializer.toJSON(EMPTY_JSON);

  // TODO(mattmoor): The logic in hudson.scm.SCMS uses the index of the SCM
  // among the collection of compatible SCMS for the given project to
  // determine which class to bind instead of relying on the '$class' field.
  // I have prototyped a fix for this, but until it can be pushed back,
  // we cannot test this.
  // JSONObject scm = (JSONObject) JSONSerializer.toJSON(GITSCM_JSON);
  // json.put("scm", scm);

  JSONArray builders = (JSONArray) JSONSerializer.toJSON(BUILDERS2_JSON);
  json.put("builder", builders);

  JSONArray publishers = (JSONArray) JSONSerializer.toJSON(PUBLISHERS_JSON);
  json.put("publisher", publishers);

  Job job = underTest.bindJob(Jenkins.getInstance(), NAME, json);

  assertNotNull(job);
  assertThat(job, instanceOf(FreeStyleProject.class));
  assertEquals(NAME, job.getName());

  FreeStyleProject project = (FreeStyleProject) job;

  assertEquals(1, project.getBuilders().size());
  assertThat(project.getBuilders().get(0), instanceOf(Maven.class));
  // NOTE: getPublishers returns a Map, but the above returns a list
  assertEquals(1, project.getPublishers().values().size());
  assertThat(project.getPublishers().values().toArray()[0],
      instanceOf(BuildTrigger.class));
}
 
开发者ID:jenkinsci,项目名称:yaml-project-plugin,代码行数:34,代码来源:BinderTest.java


示例9: getDetails

import hudson.tasks.Maven; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String getDetails(Maven maven) {
  return maven.getTargets();
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:8,代码来源:BuildStepDetailsProvider.java


示例10: getName

import hudson.tasks.Maven; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String getName(Maven maven) {
  return com.google.jenkins.plugins.deploy.Messages.BuildStepDetailsProvider_MavenName();
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:8,代码来源:BuildStepDetailsProvider.java


示例11: getFullCmd

import hudson.tasks.Maven; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public String getFullCmd(Maven maven) {
  return "mvn " + getDetails(maven);
}
 
开发者ID:GoogleCloudPlatform,项目名称:jenkins-deployment-manager-plugin,代码行数:8,代码来源:BuildStepDetailsProvider.java


示例12: getMavenDescriptor

import hudson.tasks.Maven; //导入依赖的package包/类
private Maven.DescriptorImpl getMavenDescriptor() {
    return Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class);
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:4,代码来源:WithMavenStep.java


示例13: getMavenInstallations

import hudson.tasks.Maven; //导入依赖的package包/类
/**
 * @return maven installations on this instance
 */
private static MavenInstallation[] getMavenInstallations() {
    return Jenkins.getActiveInstance().getDescriptorByType(Maven.DescriptorImpl.class).getInstallations();
}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:7,代码来源:WithMavenStepExecution.java



注:本文中的hudson.tasks.Maven类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NameNodeEditLogRoller类代码示例发布时间:2022-05-23
下一篇:
Java IChimpDevice类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap