orctom/was-maven-plugin

Builds does not fail-on-error

mortench3000 opened this issue · 5 comments

The failOnError parameter does not seem to have any effect as my builds still succeeds even if the wsadmin commands fail. I don't see any references to WebSphereModel.isFailOnError() anywhere, which leads me to suspect that the feature was not fully implemented.

------------------------------------------------------------
[INSTALLING APPLICATION] xx.yy.portal.zzz.com angularTheme-ear
2015-nov-06 12:59:07 CET
------------------------------------------------------------

options:  ['-deployws', '-distributeApp', '-appname', 'angularTheme-ear', '-clus
ter', 'PortalCluster', '-MapModulesToServers', [['.*', '.*', 'WebSphere:cell=myp
or1Cell01,cluster=PortalCluster+WebSphere:cell=mypor1Cell01,node=myporihs2
UnmanagedNode,server=webserver1+WebSphere:cell=mypor1Cell01,node=myporihs1Un
managedNode,server=webserver1']], '-MapWebModToVH', [['.*', '.*', 'default_host'
]]]

INSTALLING
FAILED to install application:  angularTheme-ear
----------
Traceback (most recent call last):
  File "<string>", line 144, in installApplication
com.ibm.ws.scripting.ScriptingException: com.ibm.ws.scripting.ScriptingException
: com.ibm.websphere.management.filetransfer.client.TransferFailedException

java.net.UnknownHostException: java.net.UnknownHostException: mypor1.yyy.zzz.com

------------------------------------------------------------
[FINISHED] xx.yy.portal.zzz.com angularTheme-ear
2015-nov-06 12:59:26 CET
------------------------------------------------------------
Return code: 0
[INFO] ====================    post-steps    ======================
[INFO] Skipped, not configured.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] angularTheme-theme ................................. SUCCESS [  0.484 s]
[INFO] angularTheme-static ................................ SUCCESS [ 24.511 s]
[INFO] angularTheme-dynamic ............................... SUCCESS [  1.233 s]
[INFO] angularTheme-ear ................................... SUCCESS [ 36.216 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:02 min
[INFO] Finished at: 2015-11-06T12:59:26+01:00
[INFO] Final Memory: 13M/26M
[INFO] ------------------------------------------------------------------------

You are right, as the wsadmin command returns 0.
Do me a favor, can you try to remove the try...catch in the script and see what you get.

Same execution but without the try/catch in installApplication:

------------------------------------------------------------
[INSTALLING APPLICATION] xx.yy.portal.zzz.com angularTheme-ear
2015-nov-06 15:48:50 CET
------------------------------------------------------------

options:  ['-deployws', '-distributeApp', '-appname', 'angularTheme-ear', '-clus
ter', 'PortalCluster', '-MapModulesToServers', [['.*', '.*', 'WebSphere:cell=myp
or1Cell01,cluster=PortalCluster+WebSphere:cell=mypor1Cell01,node=myporihs2
UnmanagedNode,server=webserver1+WebSphere:cell=mypor1Cell01,node=myporihs1Un
managedNode,server=webserver1']], '-MapWebModToVH', [['.*', '.*', 'default_host'
]]]

INSTALLING
WASX7017E: Exception received while running file "C:\Users\me\sta
sh\mydsvtheme\source\angularTheme-ear\target\was-maven-plugin\py\deploy-my.
portal.deploy.xxx.zzz.com-angularTheme-ear-20151106-154839-781.py"; exception in
formation: com.ibm.websphere.management.filetransfer.client.TransferFailedExcept
ion
java.net.UnknownHostException: java.net.UnknownHostException: mypor1.yyy.zzz.com

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] angularTheme-theme ................................. SUCCESS [  0.268 s]
[INFO] angularTheme-static ................................ SUCCESS [ 20.065 s]
[INFO] angularTheme-dynamic ............................... SUCCESS [  1.274 s]
[INFO] angularTheme-ear ................................... FAILURE [ 29.560 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 51.367 s
[INFO] Finished at: 2015-11-06T15:49:07+01:00
[INFO] Final Memory: 13M/25M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.orctom.mojo:was-maven-plugin:1.0.12:deploy (d
eploy) on project angularTheme-ear: Execution deploy of goal com.orctom.mojo:was
-maven-plugin:1.0.12:deploy failed: Failed to deploy, return code: 105. Please m
ake sure target WAS is alive and reachable. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :angularTheme-ear

So that's better in terms of getting correct failure. What do you suggest for a permanent solution ?

Thanks!
I put try...catch in order to get useful information when the script goes wrong, but this for a lot of cases makes the return code of the execution of the script to be 0, which means successful.

I might re-throw (re-raise) the exception again at the end of each catch block.

And I would change the plugin code to check the output of the execution of the script to see if contains string Exception or some other keywords. (I'll put this into next release)

Ok, thanks...

It's in 1.1.1 now