List of usage examples for org.apache.maven.plugin MojoExecution getGoal
public String getGoal()
From source file:co.leantechniques.maven.Project.java
License:Apache License
private PluginExecution addExecution(ExecutionEvent event) { MojoExecution mojoExecution = event.getMojoExecution(); PluginExecution execution = new PluginExecution(plugin(event), mojoExecution.getGoal(), mojoExecution.getExecutionId()); pluginExecutions.add(execution);//from w ww. j a v a 2 s . com indexedExecutions.put(generateKeyFrom(event), execution); return execution; }
From source file:co.leantechniques.maven.Project.java
License:Apache License
private String generateKeyFrom(ExecutionEvent event) { MojoExecution mojoExecution = event.getMojoExecution(); return mojoExecution.getGroupId() + mojoExecution.getArtifactId() + mojoExecution.getGoal() + mojoExecution.getExecutionId(); }
From source file:com.basistech.m2e.code.quality.shared.AbstractMavenPluginProjectConfigurator.java
License:Open Source License
protected MojoExecution findForkedExecution(MojoExecution primary, String groupId, String artifactId, String goal) {/*w w w . ja va 2 s. c o m*/ Map<String, List<MojoExecution>> forkedExecutions = primary.getForkedExecutions(); MojoExecution goalExecution = null; for (List<MojoExecution> possibleExecutionList : forkedExecutions.values()) { for (MojoExecution possibleExecution : possibleExecutionList) { if (groupId.equals(possibleExecution.getGroupId()) && artifactId.equals(possibleExecution.getArtifactId()) && goal.equals(possibleExecution.getGoal())) { goalExecution = possibleExecution; break; } } if (goalExecution != null) { break; } } return goalExecution; }
From source file:com.basistech.m2e.code.quality.shared.MavenPluginWrapper.java
License:Open Source License
public static boolean mojoExecutionForPlugin(MojoExecution mojoExecution, String groupId, String artifactId, String goal) {/*w w w . j a v a 2 s . co m*/ return groupId.equals(mojoExecution.getGroupId()) && artifactId.equals(mojoExecution.getArtifactId()) && (goal == null || goal.equals(mojoExecution.getGoal())); }
From source file:com.carrotgarden.m2e.scr.BuildParticipant.java
License:BSD License
/** * /*from w w w . j a v a 2s. c o m*/ * this version of parameter lookup seems to work * * {@link org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator} * * */ protected <T> T getParameterValue(final String parameter, final Class<T> asType) throws CoreException { final MavenSession session = getSession(); final MojoExecution mojoExecution = getMojoExecution(); // final Plugin plugin = mojoExecution.getPlugin(); final PluginExecution execution = new PluginExecution(); execution.setConfiguration(mojoExecution.getConfiguration()); final String goal = mojoExecution.getGoal(); // final T value = getMaven().getMojoParameterValue(parameter, asType, session, plugin, execution, goal); // log.info("@@@ value=" + value); return value; }
From source file:com.coderplus.m2e.jaxwscore.CoderPlusBuildParticipant.java
License:Open Source License
@Override public Set<IProject> build(final int kind, final IProgressMonitor monitor) throws Exception { final MojoExecution execution = getMojoExecution(); if (execution == null) { return null; }//from ww w. j av a2 s .c o m IMaven maven = MavenPlugin.getMaven(); MavenProject mavenProject = getMavenProjectFacade().getMavenProject(); final BuildContext buildContext = getBuildContext(); boolean skip = Boolean.TRUE.equals(maven.getMojoParameterValue(mavenProject, execution, SKIP, Boolean.class, new NullProgressMonitor())); if (skip) { return null; } File staleFile = maven.getMojoParameterValue(mavenProject, execution, STALE_FILE, File.class, new NullProgressMonitor()); boolean xnocompile = Boolean.TRUE.equals(maven.getMojoParameterValue(mavenProject, execution, XNOCOMPILE, Boolean.class, new NullProgressMonitor())); boolean keep = Boolean.TRUE.equals(maven.getMojoParameterValue(mavenProject, execution, KEEP, Boolean.class, new NullProgressMonitor())); File outputDirectory = maven.getMojoParameterValue(mavenProject, execution, OUTPUT_DIRECTORY, File.class, new NullProgressMonitor()); if ((keep || xnocompile) && outputDirectory != null) { if (WSIMPORT_TEST.equals(execution.getGoal()) || WSGEN_TEST.equals(execution.getGoal())) { mavenProject.addTestCompileSourceRoot(outputDirectory.getAbsolutePath()); } else { mavenProject.addCompileSourceRoot(outputDirectory.getAbsolutePath()); } } if (buildContext.isIncremental() && staleFile != null && staleFile.exists()) { File wsdlDirectory = maven.getMojoParameterValue(mavenProject, execution, WSDL_DIRECTORY, File.class, new NullProgressMonitor()); File bindingDirectory = maven.getMojoParameterValue(mavenProject, execution, BINDING_DIRECTORY, File.class, new NullProgressMonitor()); Scanner wsdlScanner = buildContext.newScanner(wsdlDirectory); Scanner bindingScanner = buildContext.newScanner(bindingDirectory); String[] includedBindingFiles = null; String[] includedWsdlFiles = null; if (bindingScanner != null) { bindingScanner.scan(); includedBindingFiles = bindingScanner.getIncludedFiles(); } if (wsdlScanner != null) { wsdlScanner.scan(); includedWsdlFiles = wsdlScanner.getIncludedFiles(); } if ((includedWsdlFiles == null || includedWsdlFiles.length == 0) && (includedBindingFiles == null || includedBindingFiles.length == 0)) { //ignore if there were no changes to the resources and was an incremental build return null; } } setTaskName(monitor); //execute the maven mojo final Set<IProject> result = executeMojo(kind, monitor); //refresh the output directory if (outputDirectory != null && outputDirectory.exists()) { buildContext.refresh(outputDirectory); } return result; }
From source file:com.coderplus.m2e.jaxwscore.CoderPlusProjectConfigurator.java
License:Open Source License
@Override public void configureRawClasspath(ProjectConfigurationRequest request, IClasspathDescriptor classpath, IProgressMonitor monitor) throws CoreException { IMavenProjectFacade facade = request.getMavenProjectFacade(); MavenProject mavenProject = facade.getMavenProject(); IProject project = facade.getProject(); addNature(request.getProject(), "org.eclipse.jdt.core.javanature", monitor); for (MojoExecution execution : getMojoExecutions(request, monitor)) { boolean xnocompile = Boolean.TRUE.equals(maven.getMojoParameterValue(mavenProject, execution, XNOCOMPILE, Boolean.class, new NullProgressMonitor())); boolean keep = Boolean.TRUE.equals(maven.getMojoParameterValue(mavenProject, execution, KEEP, Boolean.class, new NullProgressMonitor())); File outputDirectory = maven.getMojoParameterValue(mavenProject, execution, OUTPUT_DIRECTORY, File.class, new NullProgressMonitor()); if ((keep || xnocompile) && outputDirectory != null) { if (WSIMPORT_TEST.equals(execution.getGoal()) || WSGEN_TEST.equals(execution.getGoal())) { IPath relativeSourcePath = MavenProjectUtils.getProjectRelativePath(project, outputDirectory.getAbsolutePath()); classpath.addSourceEntry(project.getFullPath().append(relativeSourcePath), facade.getTestOutputLocation(), true); } else { IPath relativeSourcePath = MavenProjectUtils.getProjectRelativePath(project, outputDirectory.getAbsolutePath()); classpath.addSourceEntry(project.getFullPath().append(relativeSourcePath), facade.getOutputLocation(), true); }//from w w w . jav a2 s.co m } } }
From source file:com.github.kingamajick.admp.eclipse.build.BuildParticipantFactory.java
License:Apache License
public MojoExecutionBuildParticipant create(final MojoExecution execution) { MojoExecutionBuildParticipant buildParticipant; if (UNPACK_GOAL.equals(execution.getGoal())) { buildParticipant = new UnpackBuildParticipant(execution, true); } else if (RASTERIZE_GOAL.equals(execution.getGoal())) { buildParticipant = new RasterizeBuildParticipant(execution, true); } else {/* w ww .j a va 2 s . com*/ buildParticipant = new MojoExecutionBuildParticipant(execution, true); } Activator.getDefault().getInjector().injectMembers(buildParticipant); return buildParticipant; }
From source file:com.github.sdedwards.m2e_nar.internal.CProjectConfigurator.java
License:Apache License
@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//ww w.j a v a2 s .c om 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); }
From source file:com.github.sdedwards.m2e_nar.internal.MavenUtils.java
License:Apache License
public static List<MojoExecution> getExecutions(final String goal, final ConfiguratorContext context, final IMavenProjectFacade facade, final IProgressMonitor monitor) throws CoreException { final List<MojoExecution> compileExecutions = new ArrayList<MojoExecution>(); final Map<String, Set<MojoExecutionKey>> configuratorExecutions = AbstractProjectConfigurator .getConfiguratorExecutions(facade); final Set<MojoExecutionKey> executionKeys = configuratorExecutions .get(CProjectConfigurator.CONFIGURATOR_ID); if (executionKeys != null) { for (MojoExecutionKey key : executionKeys) { final MojoExecution mojoExecution = facade.getMojoExecution(key, monitor); if (goal.equals(mojoExecution.getGoal())) { compileExecutions.add(mojoExecution); }/*from w w w . ja va2 s . c o m*/ } } return compileExecutions; }