我想自动将我们的持续集成服务器中的EAR文件构建部署到WebSphere应用程序服务器
. 我查了蚂蚁的任务
wsdeploy
但是
documentation
真的一点帮助都没有。我在我的Ant脚本中添加了这个:
wsdeploy ant任务
<classpath>
<fileset dir="${dir.was.plugins}">
<include name="**/*.jar" />
</fileset>
</classpath>
<taskdef name="wsdeploy" classname="com.ibm.websphere.ant.tasks.WSDeploy" />
<target name="deploy">
<wsdeploy inputFile="myearfile.ear"
outputFile="myearfile_fordeployment.ear"
classpath="${classpath}"
debug="true"
ignoreErrors="false"
noValidate="false"
trace="true" />
</target>
我的问题
I don't know how to specify the remote server address and I'd be glad to get some links to tutorials or maybe a working Ant snippet to deploy an EAR to the websphere server.
我们已经为portlet运行了一些scp和sshexec任务,它们正在调用
XMLAccess
interface to place and start the portlets. Do I have to adapt that scripts for the EAR too or is that a completely wrong way to automatically deploy an EAR file?
更新2
I rewrote my ant script and now there is no ClassNotFoundException anymore. Still, there is an unexpected behavior: The script wants to use a profile I never specified...
给蚂蚁打电话:
%WAS_HOME%\bin\ws_ant.bat -Duser.install.root="%WAS_HOME%\profiles\EXPECTEDPROFILE" -f buildall.xml "%1"
我想用
EXPECTEDPROFILE
,但下面的错误消息表明存在另一个配置文件
UNEXPECTEDPROFILE
卷入的。
输出:
wasListApps:
[wsadmin] WASX7023E: Fehler beim Erstellen der "SOAP"-Verbindung zu "MYHOST". Informationen zur Ausnahme: com.ibm.websphere.management.exception.ConnectorNotAvailableException: com.ibm.websphere.management.exception.ConnectorNotAvailableException: ADMC0016E: Das System kann keinen SOAP-Connector erstellen, um die Verbindung zum Host MYHOST an Port MYPORT herzustellen.
[wsadmin] WASX7213I: Dieser Script-Client ist mit keinem Serverprozess verbunden. Pr?fen Sie, ob in der Protokolldatei /PATH/TO/UNEXPECTEDT/PROFILE/logs\wsadmin.traceout n?here Einzelheiten enthalten sind.
[wsadmin] WASX8011W: Das AdminTask-Objekt ist nicht verfügbar.
[wsadmin] WASX7015E: Beim Ausf?hren des Befehls "$AdminApp list" ist eine Ausnahme eingetreten. Informationen zur Ausnahme:
[wsadmin] com.ibm.ws.scripting.ScriptingException: WASX7206W: Der Application Management Service ist nicht aktiv. Die Befehle f?r die Anwendungsverwaltung k?nnen nicht ausgef?hrt werden.
[wsadmin] Java Result: 103
更新1
使用wsinstallapp
读后
JoseKs answer
我试着用
wsinstallapp
要使用此Ant目标安装我的应用程序:
<taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" classpath="${dir.was.plugins}/com.ibm.ws.runtime_6.1.0.jar" />
<target name="deploy" depends="EAR">
<wsInstallApp
wasHome="${WAS_HOME}"
ear="MYAPPLICATION.ear"
options=""
properties=""
profile=""
conntype="SOAP"
host="${TargetServer}"
port="${TargetPort}"
user="${TargetUser}"
password="${TargetPwd}"
failonerror="true" />
</target>
但这就是我得到的:
deploy:
[wsInstallApp] Anwendung wird installiert [/path/to/MYAPPLICATION.ear]...
[wsadmin] Exception in thread "main" java.lang.NoClassDefFoundError: org.eclipse.core.launcher.Main
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:335)
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:91)
[wsadmin] Caused by: java.lang.ClassNotFoundException: org.eclipse.core.launcher.Main
[wsadmin] at java.net.URLClassLoader.findClass(URLClassLoader.java:496)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:631)
[wsadmin] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:597)
[wsadmin] ... 2 more
我不知道为什么任务要搜索Eclipse类…