Maven plugin imports java plugin configurations and tasks


I’m the co-founder of the GradleFx plugin, a plugin which allows people to compile Flex projects with Gradle. Now, I’ve ran into a problem with conflicting configurations and tasks when applying the maven plugin on a project which uses the GradleFx plugin. My plugin has several configurations including ‘default’, ‘archives’, ‘merged’, ‘internal’ etc. It also has some tasks with the following names ‘clean’, ‘compile’ etc.

When I apply the maven plugin it complains that it can’t apply the ‘default’ or ‘archives’ configuration because they already exist (created by GradleFx). I looked up the Maven plugin documentation and there’s nothing mentioning those configuration or task names, so I delved into the maven plugin code and apparently it’s leaning heavily on the java plugin which contains these configurations and tasks.

I thought that the only requirement to make the maven plugin work was to have an archives configuration and add the artifacts to it generated by my GradleFx plugin. But apparently it’s not and it pulls in the entire java plugin. Is there any way around this? I really want to support the maven plugin in Flex projects.

Greetz, Yennick

The ‘maven’ plugin depends on the ‘base’ plugin but not on the ‘java’ plugin. It provides additional services if the ‘java’ plugin is present.

One solution is to make your plugin apply the ‘base’ plugin and use its ‘default’ and ‘archives’ configurations and ‘clean’ task.

oh, that’s good news :slight_smile: Then it should be fairly easy to fix this in my plugin. Thanks!

I tried to apply the ‘base’ plugin to my GradleFx plugin and that seems to work, but when I apply the ‘maven’ plugin to one of the Flex projects it doesn’t add the ‘install’ task. I found this piece of code in the maven plugin code ( plugins.withType(JavaPlugin.class, new Action() {

public void execute(JavaPlugin javaPlugin) {

configureJavaScopeMappings(project.getConfigurations(), pluginConvention.getConf2ScopeMappings());


} });

So apparently the install task is only configured when the project has the java plugin, but I want to use it with a Flex project. Any ideas?