Hi all,

I would like to ask you for information if there is a way how to pass an
object to embedded gradle using tooling API (as can be done for groovy if
used directly):

The approach can be seen here:

https://github.com/if6was9/gradle-maven-plugin/blob/master/src/main/java/org/fortasoft/maven/plugin/gradle/GradleMojo.java


[CODE - embedding groovy]
// as in http://docs.codehaus.org/display/GROOVY/Embedding+Groovy
Binding bnd = new Binding();
bnd.setVariable("mavenProject", mavenProject);

GroovyShell gs = new GroovyShell(bnd);

Object retVal = gs.evaluate(someScript);
[/CODE - embedding groovy]

vs

[CODE - embedding gradle]

ProjectConnection connection = GradleConnector.newConnector()
    .forProjectDirectory(new File("someFolder"))
    .connect();

BuildLauncher build = connection.newBuild();

//select tasks to run:
build.forTasks("clean", "test");

//include some build arguments:
build.withArguments("--no-search-upward", "-i", "--project-dir",
"someProjectDir");
...
[/CODE - embedding gradle]

I am currently not able to find a way how to pass any information without
"serializing" it to an argument...

Thank you in advance,
Marian

Reply via email to