本文整理匯總了Java中org.apache.maven.plugins.annotations.LifecyclePhase類的典型用法代碼示例。如果您正苦於以下問題:Java LifecyclePhase類的具體用法?Java LifecyclePhase怎麽用?Java LifecyclePhase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LifecyclePhase類屬於org.apache.maven.plugins.annotations包,在下文中一共展示了LifecyclePhase類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initializePredefinedPhases
import org.apache.maven.plugins.annotations.LifecyclePhase; //導入依賴的package包/類
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 );
}
示例2: initPredefinedFromTo
import org.apache.maven.plugins.annotations.LifecyclePhase; //導入依賴的package包/類
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() );
}
}
示例3: testBuildDependencyFlumePlugin
import org.apache.maven.plugins.annotations.LifecyclePhase; //導入依賴的package包/類
/**
* 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();
}
示例4: testProjectPluginAssembly
import org.apache.maven.plugins.annotations.LifecyclePhase; //導入依賴的package包/類
/**
* 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();
}
示例5: buildProject
import org.apache.maven.plugins.annotations.LifecyclePhase; //導入依賴的package包/類
/**
* 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);
}