本文整理了Java中org.twdata.maven.mojoexecutor.MojoExecutor
类的一些代码示例,展示了MojoExecutor
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MojoExecutor
类的具体详情如下:
包路径:org.twdata.maven.mojoexecutor.MojoExecutor
类名称:MojoExecutor
[英]Executes an arbitrary mojo using a fluent interface. This is meant to be executed within the context of a Maven mojo. Here is an execution that invokes the dependency plugin:
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-dependency-plugin"),
version("2.0")
),
goal("copy-dependencies"),
configuration(
element(name("outputDirectory"), "${project.build.directory}/foo")
),
executionEnvironment(
project,
session,
pluginManager
)
);
[中]使用流畅的界面执行任意mojo。这意味着要在Maven mojo的上下文中执行。下面是一个调用依赖插件的执行:
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-dependency-plugin"),
version("2.0")
),
goal("copy-dependencies"),
configuration(
element(name("outputDirectory"), "${project.build.directory}/foo")
),
executionEnvironment(
project,
session,
pluginManager
)
);
代码示例来源:origin: nidi3/code-assert
private void report() throws MojoExecutionException {
executeMojo(
plugin(
groupId("org.jacoco"),
artifactId("jacoco-maven-plugin"),
version(JACOCO_VERSION)
),
goal("report"),
configuration(),
executionEnvironment(mavenProject, mavenSession, pluginManager)
);
}
代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin
public void generateObrXml(File dep, File obrXml) throws MojoExecutionException
{
executeMojo(
bndPlugin(),
goal("install-file"),
configuration(
element(name("obrRepository"), obrXml.getPath()),
// the following three settings are required but not really used
element(name("groupId"), "doesntmatter"),
element(name("artifactId"), "doesntmatter"),
element(name("version"), "doesntmatter"),
element(name("packaging"), "jar"),
element(name("file"), dep.getPath())
),
executionEnvironment()
);
}
代码示例来源:origin: allegro/grunt-maven-plugin
private Element[] createResourcesListElement(String[] resources, String elementName, Element... append) {
Element[] elements = new Element[resources.length + append.length];
int index = 0;
for (; index < resources.length; ++index) {
elements[index] = element(name(elementName), resources[index]);
}
for (int appendIndex = 0; appendIndex < append.length; appendIndex++, ++index) {
elements[index] = append[appendIndex];
}
return elements;
}
代码示例来源:origin: reactiverse/vertx-maven-plugin
/**
* Execute the mojo.
*/
public void execute() throws MojoExecutionException {
executeMojo(
plugin,
goal,
configuration,
executionEnvironment(project, session, build)
);
}
}
代码示例来源:origin: ru.yandex.qatools.allure/allure-java-inject
protected void executeAspectJPluginWithGoal(String goal) throws MojoExecutionException {
executeMojo(
getAspectJPlugin(),
goal(goal),
getAspectJPluginConfiguration(),
executionEnvironment(mavenProject, mavenSession, pluginManager)
);
}
代码示例来源:origin: org.openmrs.maven.plugins/openmrs-sdk-maven-plugin
private void cleanupPluginFiles() throws MojoExecutionException {
executeMojo(
SDKConstants.getReleasePlugin(),
goal("clean"),
configuration(),
executionEnvironment(mavenProject, mavenSession, pluginManager)
);
}
代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin
protected Xpp3Dom baseConfiguration()
{
return configuration(
element(name("driver") , dataSource.getDriver()),
element(name("url"), dataSource.getDefaultDatabase()),
element(name("username"), dataSource.getSystemUsername()),
element(name("password"), dataSource.getSystemPassword()),
// we need commit transaction for drop database and then create them again
element(name("autocommit"), "true")
);
}
代码示例来源:origin: ru.yandex.qatools.allure/allure-java-inject
protected Xpp3Dom getAspectJPluginConfiguration() {
return configuration(
element("source", javaVersion),
element("target", javaVersion),
element("complianceLevel", javaVersion),
element("aspectLibraries",
element("aspectLibrary",
element("groupId", "ru.yandex.qatools.allure"),
element("artifactId", "allure-java-aspects")
)
)
);
}
代码示例来源:origin: io.teecube.t3/t3-common
protected ExecutionEnvironment getEnvironment(MavenProject project, MavenSession session, BuildPluginManager pluginManager) {
if (executionEnvironment == null) {
executionEnvironment = executionEnvironment(project, session, pluginManager);
}
return executionEnvironment;
}
代码示例来源:origin: org.twdata.maven/mojo-executor
/**
* Defines the plugin without its version or dependencies.
*
* @param groupId The group id
* @param artifactId The artifact id
* @return The plugin instance
*/
public static Plugin plugin(String groupId, String artifactId) {
return plugin(groupId, artifactId, null);
}
代码示例来源:origin: com.atlassian.maven.plugins/maven-amps-plugin
private static Xpp3Dom configurationWithoutNullElements(Element... elements)
{
List<Element> nonNullElements = new ArrayList<Element>();
for (Element e : elements)
{
if (e != null)
{
nonNullElements.add(e);
}
}
return configuration(nonNullElements.toArray(new Element[nonNullElements.size()]));
}
代码示例来源:origin: ru.yandex.qatools.allure/allure-java-inject
protected Plugin getAspectJPlugin() {
return plugin(
"org.codehaus.mojo",
"aspectj-maven-plugin",
"1.4",
dependencies(
dependency("org.aspectj", "aspectjtools", aspectJVersion)
)
);
}
代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin
/**
* Executes the specified mojo, <i>using only the provided configuration</i>. Any configuration that has been
* applied at the project level is <i>ignored</i>.
*
* @param plugin the Maven plugin to execute
* @param goal the goal (mojo) to execute
* @param configuration the <i>complete configuration</i> to apply
* @param executionEnvironment the execution environment, providing access to the Maven project and session
* and the plugin manager
* @throws MojoExecutionException if executing the mojo fails
*/
public static void execute(Plugin plugin, String goal, Xpp3Dom configuration,
MojoExecutor.ExecutionEnvironment executionEnvironment)
throws MojoExecutionException {
MojoExecutor.executeMojo(plugin, goal, configuration, executionEnvironment);
}
代码示例来源:origin: allegro/grunt-maven-plugin
private Element[] elementsFromMap(Map<String, String> elements) {
List<Element> elementList = new ArrayList<Element>();
for (Map.Entry<String, String> entry : elements.entrySet()) {
elementList.add(element(entry.getKey(), entry.getValue()));
}
return elementList.toArray(new Element[elementList.size()]);
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-sdk
private void stopCassandra() throws MojoExecutionException {
getLog().info("Stopping cassandra...");
executeMojo(CASSANDRA_PLUGIN,
goal("stop"), cassandraStopConfiguration(),
executionEnvironment(project, session, pluginManager)
);
}
代码示例来源:origin: allegro/grunt-maven-plugin
public void addArgument(String value) {
arguments.add(element(name(ARGUMENT_NAME), value));
}
代码示例来源:origin: com.atlassian.maven.plugins/amps-maven-plugin
protected Xpp3Dom systemDatabaseConfiguration()
{
return configuration(
element(name("driver") , dataSource.getDriver()),
element(name("url"), dataSource.getDefaultDatabase()),
element(name("username"), dataSource.getSystemUsername()),
element(name("password"), dataSource.getSystemPassword()),
element(name("autocommit"), "true")
);
}
代码示例来源:origin: org.twdata.maven/mojo-executor-maven-plugin
public void execute() throws MojoExecutionException {
getLog().info("Executing with maven project " + mavenProject + " for session " + mavenSession);
if ( quiet )
{
disableLogging();
}
executeMojo(plugin, goal, toXpp3Dom(configuration),
(ignoreMavenProject ?
executionEnvironment( mavenSession, pluginManager) :
executionEnvironment( mavenProject, mavenSession, pluginManager)));
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-sdk
private Xpp3Dom cassandraStopConfiguration() {
return configuration(
element("rpcPort", String.valueOf(cassandraRpcPort)),
element("stopPort", String.valueOf(CrossMojoState.getCassandraStopPort(getPluginContext()))),
element("skip", String.valueOf(false))
);
}
代码示例来源:origin: com.yahoo.vespa/bundle-plugin
private ExecutionEnvironment createExecutionEnvironment() throws MojoExecutionException {
return executionEnvironment(
project,
session,
pluginManager);
}
内容来源于网络,如有侵权,请联系作者删除!