0

I'm using the Maven plugin was6-maven-plugin to deploy to websphere. When installing an application, there's a configuration value named "updateExisting" that should be false if I am installing a new application, and true if I am updating an existing application. I don't like having to manually toggle this value if I am fresh-installing/updating the application.

The way I see it, I can either add an uninstallApp goal to always uninstall the application before installing it, but this seems a rather silly way to do it.

I've noticed that this plugin also has a goal wsListApps that outputs all applications installed on the server. The output looks like this:

[INFO]   [wsadmin] WASX7209I: Connected to process "server1" on node 1234Node02 using SOAP connector;  The type of process is: UnManagedProcess
[INFO]   [wsadmin] DefaultApplication
[INFO]   [wsadmin] IBMUTC
[INFO]   [wsadmin] MyApplicationEAR
[INFO]   [wsadmin] ivtApp
[INFO]   [wsadmin] query

Is it possible for Maven to scan this output for the string "MyApplicationEAR" and set "updateExisting" to "true" if it is found, and leave it "false" otherwise?

FrustratedWithFormsDesigner
  • 26,726
  • 31
  • 139
  • 202

1 Answers1

2

What you need is to be able to update a maven property during the life-cycle, before the phase binded with your was6-maven-plugin. (and using this property as a value for <updateExisting>)

Unfortunately, maven properties are static and cannot be changed at runtime. So at first sight it's impossible to do.

But, there is a plugin : properties-maven-plugin you can use to define new properties at runtime. The value of the property can be defined by a groovy script. Now the question is more about how can you write a groovy script telling if your app is already there or not.

Honestly, I don't know if it's a good idea to use it. I think running the uninstall goal everytime with failOnError set to false is probably the simplest way (and so probably the best, but maybe I am missing something ?)

ben75
  • 29,217
  • 10
  • 88
  • 134
  • Is there a way to make `failOnError` *only* apply to `uninstallApp`? I want the process to fail on errors during `installApp`. – FrustratedWithFormsDesigner Mar 20 '13 at 21:24
  • 1
    yes. You must define the configuration inside execution tag. read this for more details: http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_executions_Tag – ben75 Mar 20 '13 at 21:35