本文整理汇总了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);
}