Java 类org.apache.maven.plugins.annotations.LifecyclePhase 实例源码

项目:maven-buildtime-profiler    文件:LifeCycleOrdering.java   
private void initializePredefinedPhases()
{
    // We do that explicitly here, cause otherwise
    // the clean life cycle and site life cycle are positioned
    // at the end. Looks a bit strange. Technically it's
    // not a problem.
    initPredefinedFromTo( LifecyclePhase.PRE_CLEAN, LifecyclePhase.POST_CLEAN );
    initPredefinedFromTo( LifecyclePhase.INITIALIZE, LifecyclePhase.DEPLOY );
    initPredefinedFromTo( LifecyclePhase.PRE_SITE, LifecyclePhase.SITE_DEPLOY );
}
项目:maven-buildtime-profiler    文件:LifeCycleOrdering.java   
private void initPredefinedFromTo( LifecyclePhase from, LifecyclePhase to )
{
    LifecyclePhase[] values = LifecyclePhase.values();

    for ( int item = from.ordinal(); item <= to.ordinal(); item++ )
    {
        predefinedPhases.add( values[item].id() );
    }
}
项目:flume-plugin-maven-plugin    文件:BuildDependencyPluginMojoITest.java   
/**
 * Test building a dependency into a Flume plugin.
 * 
 * @param projectName
 *            The name of the project to be built.
 * @param pluginName
 *            The name of the plugin that is expected to be constructed.
 * @param expectedDependencies
 *            A {@link Collection} of filenames expected to be packaged as dependencies of the plugin.
 * @throws Exception
 *             If any errors occur during the test run.
 */
private void testBuildDependencyFlumePlugin(String projectName, String pluginName, Collection<String> expectedDependencies) throws Exception {
    final InvocationResult result = buildProject(projectName, LifecyclePhase.INSTALL);
    assertThat(result.getExitCode()).isZero();

    final File projectTarget = new File(getTestProjectDirectory(projectName), "target");
    final File pluginFile = new File(projectTarget, formatPluginFilename(projectName, pluginName, getTestProjectVersion()));
    assertThat(pluginFile).exists();

    final File testDirectory = getTestDirectory();
    final File tarFile = new File(testDirectory, String.format("%s-1.0-SNAPSHOT-flume-plugin.tar", pluginName));
    final File untarredDirectory = new File(testDirectory, "untarred");

    final ArchiveUtils archiveUtils = getArchiveUtils();
    archiveUtils.gunzipFile(pluginFile, tarFile);
    archiveUtils.untarFile(tarFile, untarredDirectory);

    final File pluginDirectory = new File(untarredDirectory, pluginName);
    assertThat(pluginDirectory).exists();

    final File libDirectory = new File(pluginDirectory, "lib");
    final String libFilename = "flume-hdfs-sink-1.4.0.jar";
    assertThat(libDirectory).exists();
    assertThat(new File(libDirectory, libFilename)).exists();

    final File libExtDirectory = new File(pluginDirectory, "libext");
    assertThat(libExtDirectory).exists();
    for (String jarFile : expectedDependencies) {
        assertThat(new File(libExtDirectory, jarFile)).exists();
    }

    final List<String> libExtFiles = new ArrayList<String>(FileUtils.getFileNames(libExtDirectory, null, null, false));
    libExtFiles.removeAll(expectedDependencies);
    assertThat(libExtFiles).isEmpty();

    // Verify that the sink JAR, itself, was not copied into the libext directory
    assertThat(new File(libExtDirectory, libFilename)).doesNotExist();
}
项目:flume-plugin-maven-plugin    文件:BuildProjectPluginMojoITest.java   
/**
 * Test the assembly of a project into a Flume plugin.
 * 
 * @param projectName
 *            The name of the project to be assembled.
 * @param pluginName
 *            The name of the plugin to be assembled.
 * @param dependencies
 *            A {@link Collection} of filenames expected to be packaged as dependencies of the plugin.
 * @throws Exception
 *             If any errors occur during the verification.
 */
private void testProjectPluginAssembly(String projectName, String pluginName, Collection<String> dependencies) throws Exception {
    final InvocationResult result = buildProject(projectName, LifecyclePhase.INSTALL);
    assertThat(result.getExitCode()).isZero();

    final File targetDirectory = new File(getTestProjectDirectory(projectName), "target");
    assertThat(targetDirectory).exists();

    final File flumePluginTarGz = new File(targetDirectory, formatPluginFilename(projectName, pluginName, getTestProjectVersion()));
    assertThat(flumePluginTarGz).exists();

    final File gunzipped = new File(getTestDirectory(), FileUtils.removeExtension(flumePluginTarGz.getName()));
    final File untarredDirectory = new File(getTestDirectory(), "untarred");
    final ArchiveUtils archiveUtils = getArchiveUtils();
    archiveUtils.gunzipFile(flumePluginTarGz, gunzipped);
    archiveUtils.untarFile(gunzipped, untarredDirectory);

    final File pluginDirectory = new File(untarredDirectory, pluginName);
    assertThat(pluginDirectory).exists();

    final File libDirectory = new File(pluginDirectory, "lib");
    assertThat(libDirectory).exists();
    assertThat(new File(libDirectory, String.format("%s-%s.jar", projectName, getTestProjectVersion()))).exists();

    final File libExtDirectory = new File(pluginDirectory, "libext");
    assertThat(libExtDirectory).exists();
    for (String flumeDependency : dependencies) {
        assertThat(new File(libExtDirectory, flumeDependency)).exists();
    }

    final List<String> libExtFiles = new ArrayList<String>(FileUtils.getFileNames(libExtDirectory, null, null, false));
    libExtFiles.removeAll(dependencies);
    assertThat(libExtFiles).isEmpty();

    // Although JUnit is listed as a dependency, it should not be included because it's a test dependency
    assertThat(new File(libExtDirectory, "junit-4.11.jar")).doesNotExist();
}
项目:flume-plugin-maven-plugin    文件:BuildDependencyPluginMojoITest.java   
/**
 * Test building a dependency into a Flume plugin.
 * 
 * @param projectName
 *            The name of the project to be built.
 * @param pluginName
 *            The name of the plugin that is expected to be constructed.
 * @param expectedDependencies
 *            A {@link Collection} of filenames expected to be packaged as dependencies of the plugin.
 * @throws Exception
 *             If any errors occur during the test run.
 */
private void testBuildDependencyFlumePlugin(String projectName, String pluginName, Collection<String> expectedDependencies) throws Exception {
    final InvocationResult result = buildProject(projectName, LifecyclePhase.INSTALL);
    assertThat(result.getExitCode()).isZero();

    final File projectTarget = new File(getTestProjectDirectory(projectName), "target");
    final File pluginFile = new File(projectTarget, formatPluginFilename(projectName, pluginName, getTestProjectVersion()));
    assertThat(pluginFile).exists();

    final File testDirectory = getTestDirectory();
    final File tarFile = new File(testDirectory, String.format("%s-1.0-SNAPSHOT-flume-plugin.tar", pluginName));
    final File untarredDirectory = new File(testDirectory, "untarred");

    final ArchiveUtils archiveUtils = getArchiveUtils();
    archiveUtils.gunzipFile(pluginFile, tarFile);
    archiveUtils.untarFile(tarFile, untarredDirectory);

    final File pluginDirectory = new File(untarredDirectory, pluginName);
    assertThat(pluginDirectory).exists();

    final File libDirectory = new File(pluginDirectory, "lib");
    final String libFilename = "flume-hdfs-sink-1.4.0.jar";
    assertThat(libDirectory).exists();
    assertThat(new File(libDirectory, libFilename)).exists();

    final File libExtDirectory = new File(pluginDirectory, "libext");
    assertThat(libExtDirectory).exists();
    for (String jarFile : expectedDependencies) {
        assertThat(new File(libExtDirectory, jarFile)).exists();
    }

    final List<String> libExtFiles = new ArrayList<String>(FileUtils.getFileNames(libExtDirectory, null, null, false));
    libExtFiles.removeAll(expectedDependencies);
    assertThat(libExtFiles).isEmpty();

    // Verify that the sink JAR, itself, was not copied into the libext directory
    assertThat(new File(libExtDirectory, libFilename)).doesNotExist();
}
项目:flume-plugin-maven-plugin    文件:BuildProjectPluginMojoITest.java   
/**
 * Test the assembly of a project into a Flume plugin.
 * 
 * @param projectName
 *            The name of the project to be assembled.
 * @param pluginName
 *            The name of the plugin to be assembled.
 * @param dependencies
 *            A {@link Collection} of filenames expected to be packaged as dependencies of the plugin.
 * @throws Exception
 *             If any errors occur during the verification.
 */
private void testProjectPluginAssembly(String projectName, String pluginName, Collection<String> dependencies) throws Exception {
    final InvocationResult result = buildProject(projectName, LifecyclePhase.INSTALL);
    assertThat(result.getExitCode()).isZero();

    final File targetDirectory = new File(getTestProjectDirectory(projectName), "target");
    assertThat(targetDirectory).exists();

    final File flumePluginTarGz = new File(targetDirectory, formatPluginFilename(projectName, pluginName, getTestProjectVersion()));
    assertThat(flumePluginTarGz).exists();

    final File gunzipped = new File(getTestDirectory(), FileUtils.removeExtension(flumePluginTarGz.getName()));
    final File untarredDirectory = new File(getTestDirectory(), "untarred");
    final ArchiveUtils archiveUtils = getArchiveUtils();
    archiveUtils.gunzipFile(flumePluginTarGz, gunzipped);
    archiveUtils.untarFile(gunzipped, untarredDirectory);

    final File pluginDirectory = new File(untarredDirectory, pluginName);
    assertThat(pluginDirectory).exists();

    final File libDirectory = new File(pluginDirectory, "lib");
    assertThat(libDirectory).exists();
    assertThat(new File(libDirectory, String.format("%s-%s.jar", projectName, getTestProjectVersion()))).exists();

    final File libExtDirectory = new File(pluginDirectory, "libext");
    assertThat(libExtDirectory).exists();
    for (String flumeDependency : dependencies) {
        assertThat(new File(libExtDirectory, flumeDependency)).exists();
    }

    final List<String> libExtFiles = new ArrayList<String>(FileUtils.getFileNames(libExtDirectory, null, null, false));
    libExtFiles.removeAll(dependencies);
    assertThat(libExtFiles).isEmpty();

    // Although JUnit is listed as a dependency, it should not be included because it's a test dependency
    assertThat(new File(libExtDirectory, "junit-4.11.jar")).doesNotExist();
}
项目:flume-plugin-maven-plugin    文件:AbstractFlumePluginMojoITest.java   
/**
 * Build a project.
 * 
 * @param artifactId
 *            The artifact ID of the project to build.
 * @param goal
 *            The goal to invoke.
 * @return An {@link InvocationResult} indicating the result of the build.
 * @throws Exception
 *             If any errors occur during the build.
 */
protected InvocationResult buildProject(String artifactId, LifecyclePhase goal) throws Exception {
    final Properties buildProps = new Properties();
    buildProps.putAll(getBuildArguments());
    final InvocationRequest request = build.createBasicInvocationRequest(getPom(artifactId), buildProps, Collections.singletonList(goal.id()), getLogFile());
    request.setShowErrors(true);
    return build.executeMaven(request);
}
项目:flume-plugin-maven-plugin    文件:AbstractFlumePluginMojoITest.java   
/**
 * Build a project.
 * 
 * @param artifactId
 *            The artifact ID of the project to build.
 * @param goal
 *            The goal to invoke.
 * @return An {@link InvocationResult} indicating the result of the build.
 * @throws Exception
 *             If any errors occur during the build.
 */
protected InvocationResult buildProject(String artifactId, LifecyclePhase goal) throws Exception {
    final Properties buildProps = new Properties();
    buildProps.putAll(getBuildArguments());
    final InvocationRequest request = build.createBasicInvocationRequest(getPom(artifactId), buildProps, Collections.singletonList(goal.id()), getLogFile());
    request.setShowErrors(true);
    return build.executeMaven(request);
}