Hi boys, yesterday I was able to run the "ant:telnet" task under Maven.
Several people complained around that they were helpless on this topic
in the mailing list so I thought it is a good idea to tell them what's the
problem.
Since Ant 1.5.3 relias on NetComponents.jar you have to download it and
add it to the dependencies.
I've got these in my project.xml
<dependency>
<groupId>netcomponents</groupId>
<artifactId>netcomponents</artifactId>
<version>1.3.8</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
And then in my Maven.xml I added
<ant:taskdef name="telnet"
classname="org.apache.tools.ant.taskdefs.optional.net.TelnetTask">
<ant:classpath>
<ant:pathelement
location="${plugin.getDependencyPath('netcomponents:netcomponents')}"/>
<ant:path refid="maven.dependency.classpath"/>
</ant:classpath>
</ant:taskdef>
<telnet server="${j2ee.server.host}" port="50008"
timeout="1000">
<read string="ogin:"/>
<write string="${j2ee.server.username}"/>
<read string="assword:"/>
<write echo="false" string="${j2ee.server.password}"/>
<read string=">"/>
<write string="jump 0"/>
<read string=">"/>
<write string="ADD DBPOOL"/>
<read string=">"/>
<write string="GET_DRIVERS"/>
<read string=">"/>
<!-- First we ensure Driver is deployed -->
<write string="UNDEFINE_JDBC_DRIVER Oracle"/>
<read string=">"/>
<write string="DEPLOY_JDBC_DRIVER Oracle
${pom.getDependencyPath(
context.getVariable('group.external.icw').concat(':classes12') )}"/>
<read string=">"/>
<!-- Deploy datasources -->
<write string="MAKE_DATA_SOURCE
${maven.build.dir}/data-source-pool.xml"/>
<read string=">"/>
<write string="ADD DEPLOY"/>
<read string=">"/>
<write string="REMOVE_APP -a sap.com/prescriptionEAR"/>
<read string=">"/>
<write echo="true" string="exit"/>
</telnet>
Did you get it ? :)
The documentation states you should call telnet like this
<telnet ..>
<write>writestirng</write>
<read>readstring</read>
</telnet>
but the IMPLEMENTATION does like this
<telnet ..>
<write string="writestirng" />
<read string="readstring">
</telnet>
best regards to all of you ,
Kaloyan
----------------------------------------------------------
Keep In Touch With Your Life Sensors