当前位置: 首页>>代码示例>>Java>>正文


Java MavenExecution.execute方法代码示例

本文整理汇总了Java中io.takari.maven.testing.executor.MavenExecution.execute方法的典型用法代码示例。如果您正苦于以下问题:Java MavenExecution.execute方法的具体用法?Java MavenExecution.execute怎么用?Java MavenExecution.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.takari.maven.testing.executor.MavenExecution的用法示例。


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

示例1: basicItClearcaseScmTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void basicItClearcaseScmTest()
    throws Exception
{
    File projDir = resources.getBasedir( "basic-it-clearcase-scm" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean", "verify" );
    File testDir = result.getBasedir();
    result.assertLogText( "Storing buildNumber: foo" );
    result.assertLogText( "Storing buildScmBranch: UNKNOWN_BRANCH" );

    File artifact = new File( testDir, "target/buildnumber-maven-plugin-basic-it-clearcase-scm-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String scmRev = manifest.getValue( "SCM-Revision" );
    Assert.assertEquals( "foo", scmRev );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:20,代码来源:BuildNumberMojoTest.java

示例2: createTimestampItTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void createTimestampItTest()
    throws Exception
{
    File projDir = resources.getBasedir( "create-timestamp-it" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean", "verify" );
    File testDir = result.getBasedir();
    File artifact = new File( testDir, "target/buildnumber-maven-plugin-create-timestamp-it-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String timestamp = manifest.getValue( "Build-Time" );
    SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss" );
    Date theDate = format.parse( timestamp );

}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:19,代码来源:BuildNumberMojoTest.java

示例3: failLocalChangeItTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
@Ignore
// svn local db corrupted
public void failLocalChangeItTest()
    throws Exception
{
    File projDir = resources.getBasedir( "failed-local-change" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean" );
    result.assertErrorFreeLog();
    File basedir = result.getBasedir();
    File foo = new File( basedir, "foo.txt" );
    FileUtils.fileWrite( foo, "hello" );
    FileUtils.copyDirectory( new File( basedir, "DotSvnDir" ), new File( basedir, ".svn" ) );
    result = mavenExec.execute( "verify" );
    // this fail local dotSvnDir corrupted, not b/c we change local file
    result.assertLogText( "BUILD FAILURE" );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:20,代码来源:BuildNumberMojoTest.java

示例4: gitBasicItMBUILDNUM66Test

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
@Ignore
// git local database corrected
public void gitBasicItMBUILDNUM66Test()
    throws Exception
{
    File projDir = resources.getBasedir( "git-basic-it-MBUILDNUM-66" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean" );
    result.assertErrorFreeLog();
    File basedir = result.getBasedir();
    File foo = new File( basedir, "foo.txt" );
    FileUtils.fileWrite( foo, "hello" );
    FileUtils.copyDirectory( new File( basedir, "dotGitDir" ), new File( basedir, ".git" ) );
    result = mavenExec.execute( "verify" );
    // this fail local dotSvnDir corrupted, not b/c we change local file

}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:20,代码来源:BuildNumberMojoTest.java

示例5: mBuildNum83Test

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void mBuildNum83Test()
    throws Exception
{
    File projDir = resources.getBasedir( "MBUILDNUM-83" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean", "verify" );
    result.assertErrorFreeLog();

    File testDir = result.getBasedir();
    File artifact = new File( testDir, "target/buildnumber-maven-plugin-basic-it-svnjava-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String scmRev = manifest.getValue( "SCM-Revision" );
    Assert.assertEquals( "booom", scmRev ); // ??? biim?
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:19,代码来源:BuildNumberMojoTest.java

示例6: Mojo1668Test

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void Mojo1668Test()
    throws Exception
{
    if ( !isSvn18() )
    {
        System.out.println( "Not Subversion 1.8 compatible. Skip test" );
        return;
    }

    File projDir = resources.getBasedir( "MOJO-1668" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean" );
    result.assertErrorFreeLog();
    File testDir = result.getBasedir();
    FileUtils.copyDirectory( new File( testDir, "DotSvnDir" ), new File( testDir, ".svn" ) );
    result = mavenExec.execute( "clean", "verify" );

    File artifact = new File( testDir, "target/buildnumber-maven-plugin-MOJO-1668-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String buildDate = manifest.getValue( "Build-Date" );
    Assert.assertTrue( buildDate.length() > 0 );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:27,代码来源:BuildNumberMojoTest.java

示例7: noRevisionItTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void noRevisionItTest()
    throws Exception
{
    File projDir = resources.getBasedir( "norevision-it" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean", "verify" );
    result.assertErrorFreeLog();

    File testDir = result.getBasedir();
    File artifact = new File( testDir, "target/buildnumber-maven-plugin-norevision-it-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String scmRev = manifest.getValue( "SCM-Revision" );
    Assert.assertTrue( StringUtils.isBlank( scmRev ) );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:19,代码来源:BuildNumberMojoTest.java

示例8: skipItTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void skipItTest()
    throws Exception
{
    File projDir = resources.getBasedir( "skip-it" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean", "verify" );
    result.assertErrorFreeLog();

    File testDir = result.getBasedir();
    File artifact = new File( testDir, "target/buildnumber-maven-plugin-skip-it-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String buildDate = manifest.getValue( "Build-Date" );
    Assert.assertTrue( StringUtils.isBlank( buildDate ) );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:19,代码来源:BuildNumberMojoTest.java

示例9: testBasicConfiguration

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void testBasicConfiguration()
    throws Exception
{
    File projDir = resources.getBasedir( "create-metadata-it" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean", "test" );
    result.assertErrorFreeLog();

    File testDir = result.getBasedir();
    Assert.assertTrue( new File( testDir, "target/file1.properties" ).exists() );
    Assert.assertTrue( new File( testDir, "target/xxx/file1.properties" ).exists() );
    Assert.assertTrue( new File( testDir, "target/generated/build-metadata/build.properties" ).exists() );
    Assert.assertTrue( new File( testDir, "target/classes/build.properties" ).exists() );

}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:18,代码来源:CreateMetadataMojoTest.java

示例10: testBasicJsonConfiguration

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void testBasicJsonConfiguration()
    throws Exception
{
    File projDir = resources.getBasedir( "create-metadata-json-it" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean", "test" );
    result.assertErrorFreeLog();

    File testDir = result.getBasedir();
    Assert.assertTrue( new File( testDir, "target/file1.json" ).exists() );
    Assert.assertTrue( new File( testDir, "target/xxx/file1.json" ).exists() );
    Assert.assertTrue( new File( testDir, "target/generated/build-metadata/build.properties" ).exists() );
    Assert.assertTrue( new File( testDir, "target/classes/build.properties" ).exists() );

}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:18,代码来源:CreateMetadataMojoTest.java

示例11: filter

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
private Properties filter(MavenExecution verifierBuilder) throws Exception {
  MavenExecutionResult result = verifierBuilder.execute("process-resources");

  result.assertErrorFreeLog();

  Properties properties = new Properties();
  InputStream is = new FileInputStream(new File(result.getBasedir(), "target/classes/filtered.properties"));
  Reader reader = new InputStreamReader(is, "UTF-8");
  try {
    properties.load(reader);
  } finally {
    is.close();
  }

  return properties;
}
 
开发者ID:takari,项目名称:takari-lifecycle,代码行数:17,代码来源:FilteringResourcesTest.java

示例12: build

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
protected MavenExecutionResult build(String project, String... goals) throws Exception {
    log.error("Building test project {}", project);

    final String quickstartRepoDir = "org/l2x6/srcdeps/quickstarts/" + project;
    SrcdepsCoreUtils.deleteDirectory(mvnLocalRepoPath.resolve(quickstartRepoDir));

    MavenExecution execution = verifier.forProject(resources.getBasedir(project)) //
            // .withCliOption("-X") //
            .withCliOptions("-Dmaven.repo.local=" + mvnLocalRepo.getRootDirectory().toAbsolutePath().toString()) //
            .withCliOption("-s").withCliOption(mrmSettingsXmlPath);
    return execution.execute(goals);
}
 
开发者ID:srcdeps,项目名称:srcdeps-maven,代码行数:13,代码来源:AbstractMavenDepsIntegrationTest.java

示例13: basicItTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void basicItTest()
    throws Exception
{
    if ( !isSvn18() )
    {
        System.out.println( "Not Subversion 1.8 compatible. Skip test" );
        return;
    }

    File projDir = resources.getBasedir( "basic-it" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean" );
    result.assertErrorFreeLog();
    File testDir = result.getBasedir();
    FileUtils.copyDirectory( new File( testDir, "DotSvnDir" ), new File( testDir, ".svn" ) );
    result = mavenExec.execute( "clean", "verify" );
    result.assertLogText( "Storing buildNumber: 19665" );
    result.assertLogText( "Storing buildScmBranch: trunk" );

    File artifact = new File( testDir, "target/buildnumber-maven-plugin-basic-it-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String scmRev = manifest.getValue( "SCM-Revision" );
    Assert.assertEquals( "19665", scmRev );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:29,代码来源:BuildNumberMojoTest.java

示例14: basicItNoDevScmTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void basicItNoDevScmTest()
    throws Exception
{
    if ( !isSvn18() )
    {
        System.out.println( "Not Subversion 1.8 compatible. Skip test" );
        return;
    }

    File projDir = resources.getBasedir( "basic-it-no-devscm" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean" );
    result.assertErrorFreeLog();
    File testDir = result.getBasedir();
    FileUtils.copyDirectory( new File( testDir, "DotSvnDir" ), new File( testDir, ".svn" ) );
    result = mavenExec.execute( "clean", "verify" );
    result.assertLogText( "Storing buildNumber: 19665" );
    result.assertLogText( "Storing buildScmBranch: trunk" );

    File artifact = new File( testDir, "target/buildnumber-maven-plugin-basic-it-no-devscm-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String scmRev = manifest.getValue( "SCM-Revision" );
    Assert.assertEquals( "19665", scmRev );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:29,代码来源:BuildNumberMojoTest.java

示例15: basicItSvnJavaTest

import io.takari.maven.testing.executor.MavenExecution; //导入方法依赖的package包/类
@Test
public void basicItSvnJavaTest()
    throws Exception
{
    if ( !isSvn18() )
    {
        System.out.println( "Not Subversion 1.8 compatible. Skip test" );
        return;
    }

    File projDir = resources.getBasedir( "basic-it-svnjava" );

    MavenExecution mavenExec = maven.forProject( projDir );
    MavenExecutionResult result = mavenExec.execute( "clean" );
    result.assertErrorFreeLog();
    File testDir = result.getBasedir();
    FileUtils.copyDirectory( new File( testDir, "DotSvnDir" ), new File( testDir, ".svn" ) );
    result = mavenExec.execute( "clean", "verify" );
    result.assertLogText( "Storing buildNumber: 19665" );
    result.assertLogText( "Storing buildScmBranch: trunk" );

    File artifact = new File( testDir, "target/buildnumber-maven-plugin-basic-it-svnjava-1.0-SNAPSHOT.jar" );
    JarFile jarFile = new JarFile( artifact );
    Attributes manifest = jarFile.getManifest().getMainAttributes();
    jarFile.close();
    String scmRev = manifest.getValue( "SCM-Revision" );
    Assert.assertEquals( "19665", scmRev );
}
 
开发者ID:mojohaus,项目名称:buildnumber-maven-plugin,代码行数:29,代码来源:BuildNumberMojoTest.java


注:本文中的io.takari.maven.testing.executor.MavenExecution.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。