本文整理汇总了Java中org.apache.maven.execution.ExecutionEvent类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionEvent类的具体用法?Java ExecutionEvent怎么用?Java ExecutionEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionEvent类属于org.apache.maven.execution包,在下文中一共展示了ExecutionEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
public static ExecutionEventObject create(JSONObject obj, ExecutionEvent.Type t) {
Long count = (Long) obj.get("prjcount");
int prjCount = -1;
if (count != null) {
prjCount = count.intValue();
}
ExecSession toRet = new ExecSession(prjCount, t);
JSONArray arr = (JSONArray) obj.get("mvncoreurls");
if (arr != null) {
List<URL> urlList = new ArrayList<URL>();
Iterator it = arr.iterator();
while (it.hasNext()) {
String url = (String) it.next();
try {
urlList.add(new URL(url));
} catch (MalformedURLException ex) {
Exceptions.printStackTrace(ex);
}
}
toRet.setMnvcoreurls(urlList.toArray(new URL[0]));
}
return toRet;
}
示例2: growTree
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
private void growTree(ExecutionEventObject obj) {
ExecutionEventObject.Tree tn = new ExecutionEventObject.Tree(obj, currentTreeNode);
//fork events come before the mojo events, we want them as childs, to know what form belongs to which mojo.
if (tn.getStartEvent().type.equals(ExecutionEvent.Type.MojoStarted) && !currentTreeNode.getChildrenNodes().isEmpty()) {
//check if the previous fork should be added to this event
ExecutionEventObject.Tree lastSibling = currentTreeNode.getChildrenNodes().get(currentTreeNode.getChildrenNodes().size() - 1 );
while (lastSibling != null && lastSibling.getEndEvent() != null && (ExecutionEvent.Type.ForkFailed.equals(lastSibling.getEndEvent().type) || ExecutionEvent.Type.ForkSucceeded.equals(lastSibling.getEndEvent().type))) {
currentTreeNode.getChildrenNodes().remove(lastSibling);
tn.getChildrenNodes().add(0, lastSibling);
lastSibling.reassingParent(tn);
lastSibling = currentTreeNode.getChildrenNodes().isEmpty() ? null : currentTreeNode.getChildrenNodes().get(currentTreeNode.getChildrenNodes().size() - 1 );
}
}
currentTreeNode.getChildrenNodes().add(tn);
currentTreeNode = tn;
currentTreeNode.setStartOffset(IOPosition.currentPosition(inputOutput));
}
示例3: createEndForStart
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
private ExecutionEventObject createEndForStart(ExecutionEventObject start) {
ExecutionEventObject toRet;
if (start instanceof ExecMojo) {
ExecMojo startEx = (ExecMojo) start;
toRet = new ExecMojo(startEx.goal, startEx.plugin, startEx.phase, startEx.executionId, ExecutionEvent.Type.MojoFailed);
} else if (start instanceof ExecProject) {
ExecProject startPrj = (ExecProject) start;
toRet = new ExecProject(startPrj.gav, startPrj.currentProjectLocation, ExecutionEvent.Type.ProjectFailed);
} else if (start instanceof ExecSession) {
ExecSession ss = (ExecSession) start;
toRet = new ExecSession(ss.projectCount, ExecutionEvent.Type.SessionEnded);
} else {
ExecutionEvent.Type endType;
if (start.type.equals(ExecutionEvent.Type.ForkStarted)) {
endType = ExecutionEvent.Type.ForkFailed;
} else if (start.type.equals(ExecutionEvent.Type.ForkedProjectStarted)) {
endType = ExecutionEvent.Type.ForkedProjectFailed;
} else {
throw new RuntimeException("unknown event type: " + start.type);
}
toRet = new ExecutionEventObject(endType);
}
return toRet;
}
示例4: onEvent
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
@Override
public void onEvent( Object event )
throws Exception
{
try
{
if ( event instanceof ExecutionEvent )
{
executionEventHandler( (ExecutionEvent) event );
}
else if ( event instanceof org.eclipse.aether.RepositoryEvent )
{
repositoryEventHandler( (RepositoryEvent) event );
}
else
{
// TODO: What kind of event we haven't considered?
LOGGER.debug( "{}: Event {}", DPRE, event.getClass().getCanonicalName() );
}
}
catch ( Exception e )
{
LOGGER.error( DPRE + ": Exception", e );
}
}
示例5: addDetails
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
@Override
protected void addDetails(@Nonnull ExecutionEvent executionEvent, @Nonnull Xpp3Dom root) {
super.addDetails(executionEvent, root);
ArtifactRepository artifactRepository = executionEvent.getProject().getDistributionManagementArtifactRepository();
Xpp3Dom artifactRepositoryElt = new Xpp3Dom("artifactRepository");
root.addChild(artifactRepositoryElt);
if (artifactRepository == null) {
} else {
Xpp3Dom idElt = new Xpp3Dom("id");
idElt.setValue(artifactRepository.getId());
artifactRepositoryElt.addChild(idElt);
Xpp3Dom urlElt = new Xpp3Dom("url");
urlElt.setValue(artifactRepository.getUrl());
artifactRepositoryElt.addChild(urlElt);
}
}
示例6: addDetails
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
@Override
protected void addDetails(@Nonnull ExecutionEvent executionEvent, @Nonnull Xpp3Dom root) {
super.addDetails(executionEvent, root);
MavenProject parentProject = executionEvent.getProject().getParent();
if (parentProject == null) {
// nothing to do
} else {
Xpp3Dom parentProjectElt = new Xpp3Dom("parentProject");
root.addChild(parentProjectElt);
parentProjectElt.setAttribute("name", parentProject.getName());
parentProjectElt.setAttribute("groupId", parentProject.getGroupId());
parentProjectElt.setAttribute("artifactId", parentProject.getArtifactId());
parentProjectElt.setAttribute("version", parentProject.getVersion());
}
}
示例7: getConfigurationParametersToReport
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
@Nonnull
@Override
protected List<String> getConfigurationParametersToReport(ExecutionEvent executionEvent) {
MojoExecution mojoExecution = executionEvent.getMojoExecution();
if (mojoExecution == null) {
return Collections.emptyList();
}
Xpp3Dom configuration = mojoExecution.getConfiguration();
List<String> parameters = new ArrayList<String>();
for (Xpp3Dom configurationParameter : configuration.getChildren()) {
parameters.add(configurationParameter.getName());
}
return parameters;
}
示例8: mojoExecutionFullId
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
private String mojoExecutionFullId(ExecutionEvent event) {
StringBuffer result = new StringBuffer("[");
if (event.getMojoExecution() != null) {
String phase = event.getMojoExecution().getLifecyclePhase();
if (phase != null) {
result.append(phase).append(":");
}
Plugin plugin = event.getMojoExecution().getPlugin();
if (plugin != null) {
result.append(plugin.getGroupId()).append(":").append(plugin.getArtifactId()).append(":").append(plugin.getVersion());
}
String executionId = event.getMojoExecution().getExecutionId();
if (executionId != null) {
result.append(":").append(executionId);
}
String goal = event.getMojoExecution().getGoal();
if (executionId != null) {
result.append(":").append(goal);
}
}
result.append("]");
return result.toString();
}
示例9: restoreProjectState
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
private void restoreProjectState(ExecutionEvent event) {
if (event.getMojoExecution().getExecutionId() != null && event.getMojoExecution().getExecutionId().endsWith("-snapshot")) {
if (!event.getProject().getFile().equals(frozenPomFile)) {
event.getProject().setFile(frozenPomFile);
event.getProject().setArtifact(frozenArtifact);
event.getProject().getAttachedArtifacts().clear();
for (Artifact frozenAttachedArtifact : frozenAttachedArtifacts) {
event.getProject().addAttachedArtifact(frozenAttachedArtifact);
}
if (!isPomArtifact(event.getProject())) {
event.getProject().getBuild().setFinalName(frozenFinalName);
}
}
}
}
示例10: Profile
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
protected Profile(Timer timer, ExecutionEvent event, Context c) {
this.timer = timer;
this.event = event;
this.context = c;
if (context != null) {
String poolName = getAppName();
String machineName = "N/A";
try {
machineName = InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
if (getSession().getAppName() == null) {
getSession().setAppName(poolName);
}
if (getSession().getMachineName() == null) {
getSession().setMachineName(machineName);
}
}
}
示例11: DiscoveryProfile
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
public DiscoveryProfile(Context context, ExecutionEvent event,File userfile,File globalfile,boolean debug) {
super(new Timer(), event, context);
String transName = getBuildEnvironment();
String data = populateData();
if (getSession() != null) {
getSession().setEnvironment(transName);
getSession().setStartTime(new Date(this.getTimer().getStartTime()));
ProcessHelper.parseSessionPayLoad(data, getSession());
}
System.out.println("[INFO] Running From CI: " + this.isInJenkins());
System.out.println("[INFO] Build Environment: " + this.getBuildEnvironment());
System.out.println("[INFO] Application Name: " + getSession().getAppName());
}
示例12: ProjectProfile
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
public ProjectProfile(Context c, MavenProject project, ExecutionEvent event) {
super(new Timer(), event, c);
this.project = project;
this.phaseProfiles = new ArrayList<PhaseProfile>();
this.projectGroupId = project.getGroupId();
this.projectArtifactId = project.getArtifactId();
this.projectVersion = project.getVersion();
if (event != null) {
projectName = event.getProject().getName();
projectId = event.getProject().getId();
}
if (getSession() != null) {
p.setName(projectName);
p.setPayload(projectId);
p.setStartTime(new Date(this.getTimer().getStartTime()));
ProcessHelper.praseProjectPayload(projectId, p);
getSession().getProjects().put(projectName, p);
getSession().setCurrentProject(p);
}
}
示例13: sessionStarted
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
@Override
public void sessionStarted( ExecutionEvent event )
{
if ( logger.isInfoEnabled() && event.getSession().getProjects().size() > 1 )
{
logger.info( chars( '-', LINE_LENGTH ) );
logger.info( "Reactor Build Order:" );
logger.info( "" );
for ( MavenProject project : event.getSession().getProjects() )
{
logger.info( project.getName() );
}
}
}
示例14: sessionEnded
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
@Override
public void sessionEnded( ExecutionEvent event )
{
if ( logger.isInfoEnabled() )
{
if ( event.getSession().getProjects().size() > 1 )
{
logReactorSummary( event.getSession() );
}
logResult( event.getSession() );
logStats( event.getSession() );
logger.info( chars( '-', LINE_LENGTH ) );
}
}
示例15: mojoStarted
import org.apache.maven.execution.ExecutionEvent; //导入依赖的package包/类
/**
* <pre>--- mojo-artifactId:version:goal (mojo-executionId) @ project-artifactId ---</pre>
*/
@Override
public void mojoStarted( ExecutionEvent event )
{
if ( logger.isInfoEnabled() )
{
StringBuilder buffer = new StringBuilder( 128 );
buffer.append( "--- " );
append( buffer, event.getMojoExecution() );
append( buffer, event.getProject() );
buffer.append( " ---" );
logger.info( "" );
logger.info( buffer.toString() );
}
}