本文整理匯總了Java中org.apache.maven.plugin.MojoExecution.getGoal方法的典型用法代碼示例。如果您正苦於以下問題:Java MojoExecution.getGoal方法的具體用法?Java MojoExecution.getGoal怎麽用?Java MojoExecution.getGoal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.plugin.MojoExecution
的用法示例。
在下文中一共展示了MojoExecution.getGoal方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: releaseMojo
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
public void releaseMojo( Object mojo, MojoExecution mojoExecution )
{
if ( mojo != null )
{
try
{
container.release( mojo );
}
catch ( ComponentLifecycleException e )
{
String goalExecId = mojoExecution.getGoal();
if ( mojoExecution.getExecutionId() != null )
{
goalExecId += " {execution: " + mojoExecution.getExecutionId() + "}";
}
logger.debug( "Error releasing mojo for " + goalExecId, e );
}
}
}
示例2: build
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
@Override
public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception {
final MojoExecution mojoExecution = getMojoExecution();
log.debug("execution: {}", mojoExecution);
if (mojoExecution == null) {
return null;
}
final String phase = mojoExecution.getLifecyclePhase();
log.debug("phase: {}", phase);
final String goal = mojoExecution.getGoal();
log.debug("goal: {}", goal);
if ("bundle".equalsIgnoreCase(goal)) {
return buildBundle(kind, monitor);
} else if ("process".equalsIgnoreCase(goal)) {
return buildProcess(kind, monitor);
} else {
return super.build(kind, monitor);
}
}
示例3: debugMojoExecution
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
private void debugMojoExecution( MojoExecution mojoExecution )
{
String mojoExecId =
mojoExecution.getGroupId() + ':' + mojoExecution.getArtifactId() + ':' + mojoExecution.getVersion() + ':'
+ mojoExecution.getGoal() + " (" + mojoExecution.getExecutionId() + ')';
Map<String, List<MojoExecution>> forkedExecutions = mojoExecution.getForkedExecutions();
if ( !forkedExecutions.isEmpty() )
{
for ( Map.Entry<String, List<MojoExecution>> fork : forkedExecutions.entrySet() )
{
logger.debug( "--- init fork of " + fork.getKey() + " for " + mojoExecId + " ---" );
debugDependencyRequirements( fork.getValue() );
for ( MojoExecution forkedExecution : fork.getValue() )
{
debugMojoExecution( forkedExecution );
}
logger.debug( "--- exit fork of " + fork.getKey() + " for " + mojoExecId + " ---" );
}
}
logger.debug( "-----------------------------------------------------------------------" );
logger.debug( "Goal: " + mojoExecId );
logger.debug(
"Style: " + ( mojoExecution.getMojoDescriptor().isAggregator() ? "Aggregating" : "Regular" ) );
logger.debug( "Configuration: " + mojoExecution.getConfiguration() );
}
示例4: createMojoKey
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
private MojoKey createMojoKey( MojoExecution mojo )
{
return new MojoKey( mojo.getGroupId(), mojo.getArtifactId(), mojo.getVersion(), mojo.getGoal(),
mojo.getExecutionId(), mojo.getLifecyclePhase() );
}
示例5: getBuildParticipant
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
@Override
public AbstractBuildParticipant getBuildParticipant(IMavenProjectFacade projectFacade, MojoExecution execution, IPluginExecutionMetadata executionMetadata) {
final String goal = execution.getGoal();
if ("nar-validate".equals(goal)) {
return new MojoExecutionBuildParticipant(execution, false, true);
} else if ("nar-download".equals(goal)) {
return new MojoExecutionBuildParticipant(execution, false, true);
} else if ("nar-unpack".equals(goal)) {
return new NarBuildParticipant(execution, false, true);
} else if ("nar-gnu-configure".equals(goal)) {
// TODO
return new MojoExecutionBuildParticipant(execution, false, true);
} else if ("nar-system-generate".equals(goal)) {
return new NarBuildParticipant(execution, false, true);
} else if ("nar-resources".equals(goal)) {
return new NarBuildParticipant(execution, true, true);
} else if ("nar-gnu-resources".equals(goal)) {
// TODO
return new MojoExecutionBuildParticipant(execution, false, true);
} else if ("nar-vcproj".equals(goal)) {
// TODO
return new MojoExecutionBuildParticipant(execution, false, true);
} else if ("nar-javah".equals(goal)) {
return new NarBuildParticipant(execution, true, false);
} else if ("nar-gnu-make".equals(goal)) {
return null;
} else if ("nar-compile".equals(goal)) {
return null;
} else if ("nar-gnu-process".equals(goal)) {
return null;
} else if ("nar-testDownload".equals(goal)) {
return new MojoExecutionBuildParticipant(execution, false, true);
} else if (MavenUtils.isTestUnpack(goal)) {
return new NarBuildParticipant(execution, false, true);
} else if ("nar-testCompile".equals(goal)) {
// Note that this does not actually compile the tests, only unpacks
// test dependencies for compatibility with older versions of
// nar-maven-plugin
return new NarTestCompileBuildParticipant(execution, false, true);
} else if ("nar-test".equals(goal)) {
return null;
}
return super.getBuildParticipant(projectFacade, execution, executionMetadata);
}
示例6: build
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
@Override
public Set<IProject> build(int kind, final IProgressMonitor monitor)
throws Exception {
final MojoExecution mojoExecution = getMojoExecution();
if (mojoExecution == null) {
return null;
}
final String phase = mojoExecution.getLifecyclePhase();
log.debug("phase: {}", phase);
final String goal = mojoExecution.getGoal();
log.debug("goal: {}", goal);
final IMaven maven = MavenPlugin.getMaven();
final IMavenProjectFacade currentProject = getMavenProjectFacade();
final BuildContext buildContext = getBuildContext();
final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();
ArtifactKey artifactKey = currentProject.getArtifactKey();
String shortArtifactKey = artifactKey.getGroupId() + ":"
+ artifactKey.getArtifactId() + ":" + artifactKey.getVersion();
log.debug("artifact key: {}", shortArtifactKey);
MavenProject mavenProject = currentProject.getMavenProject();
// File basedir = mavenProject.getBasedir();
// File inputPath = new File(basedir, "src");
File inputPath = maven.getMojoParameterValue(mavenProject, mojoExecution, inputPathParam, File.class, monitor);
String outputDirectoryPath = mavenProject.getBuild().getDirectory();
File outputDirectory = new File(outputDirectoryPath);
if (INCREMENTAL_BUILD == kind || AUTO_BUILD == kind) {
log.debug("scan resources {}", inputPath);
Scanner ds = buildContext.newScanner(inputPath);
ds.scan();
String[] files = ds.getIncludedFiles();
if (files == null || files.length <= 0) {
log.debug("build check: no resource changes");
log.debug("scan deleted resources {}", inputPath);
ds = buildContext.newDeleteScanner(inputPath);
ds.scan();
files = ds.getIncludedFiles();
if (files == null || files.length <= 0) {
return null;
} else {
log.debug("build check: resources deleted");
}
} else {
log.debug("build check: resources changed");
}
} else {
log.debug("build check: full build");
}
final Set<IProject> result = super.build(kind, monitor);
IProject project = currentProject.getProject();
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
if (outputDirectory != null && outputDirectory.exists()) {
log.debug("refresh output directory: {}", outputDirectory);
buildContext.refresh(outputDirectory);
}
return result;
}
示例7: build
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
@Override
public Set<IProject> build(int kind, final IProgressMonitor monitor) throws Exception {
final MojoExecution mojoExecution = getMojoExecution();
if (mojoExecution == null) {
return null;
}
final String phase = mojoExecution.getLifecyclePhase();
log.debug("phase: {}", phase);
final String goal = mojoExecution.getGoal();
log.debug("goal: {}", goal);
final IMaven maven = MavenPlugin.getMaven();
final IMavenProjectFacade currentProject = getMavenProjectFacade();
final BuildContext buildContext = getBuildContext();
ArtifactKey artifactKey = currentProject.getArtifactKey();
String shortArtifactKey = artifactKey.getGroupId()
+ ":" + artifactKey.getArtifactId()
+ ":" + artifactKey.getVersion();
log.debug("artifact key: {}", shortArtifactKey);
MavenProject mavenProject = currentProject.getMavenProject();
File inputPath = maven.getMojoParameterValue(mavenProject, mojoExecution, inputPathParam, File.class, monitor);
String outputDirectoryPath = mavenProject.getBuild().getDirectory();
File outputDirectory = new File(outputDirectoryPath);
if (INCREMENTAL_BUILD == kind || AUTO_BUILD == kind) {
log.debug("scan resources {}", inputPath);
Scanner ds = buildContext.newScanner(inputPath);
ds.scan();
String[] files = ds.getIncludedFiles();
if (files == null || files.length <= 0) {
log.debug("build check: no resource changes");
log.debug("scan deleted resources {}", inputPath);
ds = buildContext.newDeleteScanner(inputPath);
ds.scan();
files = ds.getIncludedFiles();
if (files == null || files.length <= 0) {
return null;
} else {
log.debug("build check: resources deleted");
}
} else {
log.debug("build check: resources changed");
}
} else {
log.debug("build check: full build");
}
final Set<IProject> result = super.build(kind, monitor);
IProject project = currentProject.getProject();
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
if (outputDirectory != null && outputDirectory.exists()) {
log.debug("refresh output directory: {}", outputDirectory);
buildContext.refresh(outputDirectory);
}
return result;
}
示例8: build
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
@Override
public Set<IProject> build(int kind, final IProgressMonitor monitor) throws Exception {
final MojoExecution mojoExecution = getMojoExecution();
if (mojoExecution == null) {
return null;
}
final String phase = mojoExecution.getLifecyclePhase();
log.debug("phase: {}", phase);
final String goal = mojoExecution.getGoal();
log.debug("goal: {}", goal);
final IMaven maven = MavenPlugin.getMaven();
final IMavenProjectFacade currentProject = getMavenProjectFacade();
final BuildContext buildContext = getBuildContext();
final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();
ArtifactKey artifactKey = currentProject.getArtifactKey();
String shortArtifactKey = artifactKey.getGroupId() + ":" + artifactKey.getArtifactId() + ":" + artifactKey.getVersion();
log.debug("artifact key: {}", shortArtifactKey);
MavenProject mavenProject = currentProject.getMavenProject();
File basedir = mavenProject.getBasedir();
File resourcesDirectory = new File(basedir, "src");
String outputDirectoryPath = mavenProject.getBuild().getDirectory();
File outputDirectory = new File(outputDirectoryPath);
if (INCREMENTAL_BUILD == kind || AUTO_BUILD == kind) {
log.debug("scan resources {}", resourcesDirectory);
Scanner ds = buildContext.newScanner(resourcesDirectory);
ds.scan();
String[] files = ds.getIncludedFiles();
if (files == null || files.length <= 0) {
log.debug("build check: no resource changes");
log.debug("scan deleted resources {}", resourcesDirectory);
ds = buildContext.newDeleteScanner(resourcesDirectory);
ds.scan();
files = ds.getIncludedFiles();
if (files == null || files.length <= 0) {
return null;
} else {
log.debug("build check: resources deleted");
}
} else {
log.debug("build check: resources changed");
}
} else {
log.debug("build check: full build");
}
final Set<IProject> result = super.build(kind, monitor);
IProject project = currentProject.getProject();
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
// IFolder folder = project.getFolder("target");
// folder.accept(new IResourceVisitor() {
// @Override
// public boolean visit(IResource resource) throws CoreException {
// resource.touch(monitor);
// return true;
// }
// });
if (outputDirectory != null && outputDirectory.exists()) {
log.debug("refresh output directory: {}", outputDirectory);
buildContext.refresh(outputDirectory);
}
return result;
}
示例9: ExecutionKey
import org.apache.maven.plugin.MojoExecution; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param mojoExecution The mojo execution as provided by Maven.
*/
private ExecutionKey(MojoExecution mojoExecution) {
this.goal = mojoExecution.getGoal();
this.execution = mojoExecution.getExecutionId();
}