Calling Maven Plugin from Gradle - Weblogic Portal specifically


(Eric Deandrea) #1

Starting with the 10.3.2 release of Weblogic portal Oracle has dropped support of their ant tasks for building WebLogic Portal applications in favor of Maven & Eclipse. This is making it a real headache for us because it seems that unless you are using Maven then it is impossible to build Weblogic portal applications in a CI server environment. They do support desktop users to be able to do it with Eclipse, but without Maven we can not build an application for Weblogic Portal automatically/programatically.

Has anyone encountered this, either using Gradle to build a Weblogic Portal application or by doing it some other way?


(Peter Niederwieser) #2

Dropping Ant support in favor of the technologies you mention sounds like a really bad decision for automation purposes. Anyway, you can always invoke Maven from your Gradle build, say with an ‘exec’ task. Unless you already have or are planning to develop a way to provision Maven automatically, this will require Maven to be installed and the M2_HOME environment variable to be set. In a future Gradle release, we plan to support reuse of Maven plugins as we already do for Ant tasks.


(Eric Deandrea) #3

I was hoping that was not the answer - although I thought it might be :frowning: I don’t really want to exec Maven, as we don’t have/use maven and I don’t want to create a pom for it. I was hoping there might be a way I can use the plugins that Oracle provides for it.

I agree - terrible decision on Oracle’s part…


(Felix Thomas) #4

Hello,

Just wanted to check if the feature of having the custom maven plugin to be called in the gradle script is released ?


(uklance) #5

I’ve never tried it myself, but you could try adding the maven plugin as a build time dependency. Worth a try I guess, no idea if it’d work?

import org.apache.maven.plugin.*
import org.apache.maven.plugin.logging.*
  Mojo plugin = new x.y.z.WebLogicMojo() // no idea of the class
plugin.setLog(new SystemStreamLog())
if (plugin instanceof ContextEnabled) {
   Map pluginContext = { "foo": "A", "bar": "B" }
   plugin.setPluginContext(pluginContext)
 }
plugin.execute()