<?xml version="1.0" ?>
<project name="test" default="root">
<target name="telnet">
<telnet server="10.1.1.1">
<read>login:</read>
<write>root</write>
<read>password:</read>
<write>${PASSWORD}</write>
<read>#</read>
<write>ls</write>
<read>#</read>
</telnet>
</target>
</project>
That is the code I have in a build.xml file. When I run ant (version 1.8, in bash) (I have downloaded and copied over the jars for commons-net-2.0 and jakarta-oro-2.0.8 already), this is the output I get:
Buildfile: /home/sagar/build.xml
telnet:
and then it just sits there. When I do a "who" on my server, I can see "System" waiting on login. But there is no progress after this. I can telnet into the server using normal telnet means (putty, bash, etc).
I even tried the full telnet command instead of read/write:
<telnet server="10.1.1.1" userid="root" password="root">
Any help is much appreciated!
Note: JRE 1.5, Ant 1.8, commons-net version 2.0, jakarta version 2.0.8
Figured it out. For anyone else who has this issue:
Ant 1.8.0 does not seem to work with commons-net-telnet. Not sure why, but if you can go down to version 1.7, it will work.
6 hours of head banging and frustration later, it is an undocumented version issue. Great! >:
Not an expert in Ant (I use Nant on the Dark Side) but looking at the telnet task it looks like there is an attribute called initialCR which sends a carriage return after login - the default value appears to be 'no'.
My thinking is that the username/password has not been submitted, i.e. its just waiting for the "pseudo enter key" to be pressed.
http://ant.apache.org/manual/Tasks/telnet.html
Hope this helps
Related
Apache OfBiz is not installing correctly, and fails to compile in the command prompt.
After creating the system variable JAVA_HOME to C:\Program Files\Java\jdk1.8.0_40, and editing "Path" to be C:\Program Files (x86)\Java\jre7\bin;C:\apache-ant-1.9.4\bin, I downloaded OfBiz 13.07.01 to my C:\ folder and unzipped it there. In the command prompt, I typed the following:
C:\Users\CalS>cd C:\apache-ofbiz-13.07.01
C:\apache-ofbiz-13.07.01>ant load-seed
Then, after about 50 seconds, I get this:
BUILD FAILED
C:\apache-ofbiz-13.07.01\build.xml:229: the following error occurred while executing this line:
C:\apache-ofbiz-13.07.01\build.xml:248: the following error occurred while executing this line:
C:\apache-ofbiz-13.07.01\build.xml:39: the following error occurred while executing this line:
C:\apache-ofbiz-13.07.01\build.xml:91: compile failed; see the compiler error output for details.
Please note it has been years since I dealt with DOS, so I do not know how to access the error output.
This is after I get a few dozen errors like:
[javac16] class file for org.ofbiz.widget.ContentWorkerInterfaice not found
and
[javac16] warning: [options] bootstrap class path not set in conjunctions with -source 1.6
Under 'classes'.
Misc. I have tried 'ant run-install' and 'load-demo' commands without avail. I've followed step-by-step tutorials, but very likely missed something. Please let me know what I can do to fix this and run this program successfully. Thanks!
Please have a look at the following Apache Jira Tickets for OFBiz where your problem is addressed and was fixed, so that OFBiz could be build with java 1.8.
The build errors occur due to missing fileset entries in the build.xml for some applications (party, workeffort, product, order, ebay, and pos), see: OFBIZ-5835
A fix is available in related ticket: OFBIZ-6079
There was another bug in the current release branches (checked 14.12.01, 12.04.06, 13.07.02) that I fixed last week. The fix is already committed to the branches.
See: OFBIZ-6252
You have to compile/run with the same Java version.
Seems you have some inconsistencies: JAVA_HOME ist 1.8, Path is set to jre 7 and the warning states it is using an 1.6 compiler.
With the 13.07. Release, using Java 1.7 or 1.8 is recommended and supported.
Alright, so it looks like Apache OFBiz and Java JDK 1.8.XX don't get along. I found help on another forum that confirmed the discrepancy in compatibility between OFBiz 13.07.01/Apache ant 1.9.4 and JDK 1.8.XX. This will cause the compiling of the Apache Ant to fail (which seems to run off of JDK 1.6).
I remedied the problem by downloading the archived JDK 1.7.0_67 from Oracle, re-mapping the System Variables accordingly, and re-initializing the Command Prompt.
It works now! Thank you all for your contributions.
Though solved, let me add something important. JDK version is not always an issue in such errors. Ofbiz v13.X.X works well on JDK 1.7 and above. The error shown is a peculiar issue with Ofbiz v13.07.01 dist.
As Martin pointed out, one need to add widget jars in the classpath of order, party, product & workeffort. Add the below line
<fileset dir="../../framework/widget/build/lib" includes="*.jar"/>
in build.xml of order, party, product & workeffort under applications directory.
I am running the following command from my ant target:
<exec executable="${soa.mypath}\deploy.exe" failonerror="true" vmlauncher="false">
<arg value="-n" />
<arg value="${myfile}" />
</exec>
Where ${soa.mypath} is B:\bin.
This drive B is a network drive that I mapped on a other server.
when I connect remotly to the server where that ant script is running I can totally see and browse the B drive via the Windows explorer and the user I use is the same user that runs tha ant script.
However when I run my target, I got this error:
[exec] The system cannot find the drive specified.
Which is very weird.
Do you know if I am missing some option in the exec command?
Thank you,
Regards
Using ant 1.9.3 under Windows 8.1 I was able to get this to work with no problem with a network-mounted drive, including various combinations of forward and backslashes in the path.
My only suggestion is to replace your property with the hard-coded executable path (B:\bin\deploy.exe) in the exec task and see if that works. Also - use hard-coded path to ${myfile}.
If deploy.exe has a -version command or similar you might also try that, to rule out the problem actually being in the drive/path of ${my file}.
hth
I am having issues with an SSHEXEC ant task.
I am trying to connect to a remote host and execute a command.
I am trying to use "keyfile" so I do not need to use user/pass and hitting an issue.
I can get it to connect, but getting prompted for:
[sshexec] Connecting to $HOST:22
[sshexec] Kerberos username [$Local_USER]:
[sshexec] Kerberos password for $Local_USER:
Now if I just hit return at each prompt, it proceeds and executes the command.
I am using this method for automation, so defeats the purpose if you need to interact.
Here is the ANT syntax:
<target name="explode" depends="deploy" description="Creating build on Deployment Server">
<sshexec host="${host}"
username="${user}"
keyfile="c:\paul\testkey"
trust="true"
command="${bin}/createBuild.sh"/>
</target>
Ant version - 1.8.3
Jsch version - jsch-0.1.42 (also tried with jsch-0.1.29)
Can anyone help or advise if I am doing something wrong?
Thanks in advance.
Paul
The issue here lies within Java 7.
In JAVA 7 they have introduced Kerberos into the java.security and in such this has caused the issue to prompt for kerberos user / password before proceeding.
I have fixed this issue by downgrading to Java 1.6.
I am still researching the fix for the 1.7 version of Java - may require further configuration of the kerberos conf file for java.
You can downgrade to Java 1.6 as Cambolie suggested or you can just add -noinput to fix this problem.
For example:
ant -noinput [some_target]
This issue has now been addressed in the latest versions of Ant (1.9.1) and Jsch (0.1.50).
There was a bug report with Apache which shows it having been fixed as of Jan-2013.
This is probably a misconfiguration on the remote side. It certainly shouldn't ask for the user name. Talk to your sysadmin about this. I'm also worried about Kerberos because that's completely unrelated to SSH.
Also make sure the public key is installed in the user's account.
I am trying to deploy a console application to a folder on a DMZ server using autodeploy with MSBuild and Team Foundation Server.
I am already deploying multiple sites to that same server and it works great. I have tried multiple ways but the files are not deployed.
First, I tried to deploy the console app in the same way as i do for my web site, ie:
<MSBuild
Projects="$(SolutionRoot)\MySolution.sln"
Properties="AllowUntrustedCertificate=True;AuthType=Basic;
Configuration=DEBUG;CreatePackageOnPublish=True;
DeployIisAppPath=Default Website/dummy.dev.myapp;
DeployOnBuild=True;DeployTarget=MsDeployPublish;
MSDeployPublishMethod=WMSvc;
MsDeployServiceUrl=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd;
UserName=userid;Password=password;UseMsdeployExe=True"
/>
Without success.
EDIT: No error message is returned. It all seems to go well.
Then, I also tried to deploy the console app as follows:
<Exec Command=""C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe"
-verb:sync
-source:contentpath="$(OutDir)\MyApp.Precompiled"
-dest:contentpath="D:\dev.myapp",computername=xxx.xxx.xxx.xxx,username=userid,password=password"
ContinueOnError="false" />
I actually also tried with computername as https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd.
EDIT: The following is what I got.
EXEC: FileOrFolderNotFound
EXEC: Object of type 'contentPath' and path 'E:\Builds\1...\dev.myapp' cannot be created.
EXEC: The path '\?\E:\Builds\1...\dev.myapp' is not valid.
EXEC: 1.
E:\Builds\1...\BuildType\Targets\Deploy.targets (142): The command ""C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe" -verb:sync -source:contentpath="E:\Builds\1...\dev.myapp" -dest:contentpath="D:\dev.myapp",computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd,username=userid,password=password" exited with code -1.
I realize I haven't read all of the error, Do I really need an UNC path?
Does anyone know how to do this?
I finally found out how to make it work.
<Exec Command=""C:\Program Files\IIS\Microsoft Web Deploy V2\MSDeploy.exe"
-verb:sync
-source:contentpath="$(OutDir)\MyApp.Precompiled"
-dest:contentpath="D:\dev.myapp",computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd,username=userid,password=password,authtype=Basic
-allowUntrusted=True"
ContinueOnError="false" />
I changed computername to computername=https://xxx.xxx.xxx.xxx:8172/MsDeploy.axd, added authtype=Basic and allowUntrusted=True and voila it worked.
It was quite frustrating not having any kind of feedback of what went wrong with the first option. But when I was using the second alternative I got feedback to work with.
If anyone know how to make this work using the MSBuild task, please feel free to enlighten me.
Try dirPath provider instead of contentPath, it'll behave more like a folder sync rather than IIS web site deployment.
Considering the sync worked using the EXEC task, did you make sure you have the Microsoft.WebApplication.targets in your csproj (or vbproj) file? I could see it just ignoring that msbuild task without the correct targets file included.
For example in my web service project files, I have this towards the bottom of my csproj file
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
I am trying to set up ANT build.
However when I invoke build command
helloworld_15/${NAME} does not exist.
BUILD FAILED (total time: 0 seconds)
Also the configure variables does not seems to be assigned.
However i have set them into /etc/envitonment
I tried echo $<varaiable_name> and value get displayed.
Tried to google but not solutions seems am the first one having this issue.
PS: OS Ubuntu 10.10
The environment variables of the calling shell are not, by default, converted into Ant properties. If you want to access them, you need to 'import' them using something like:
<property environment="e_pref" />
in your buildfile. Once you've done that, you can access them by means of the prefix you just set:
<echo message="NAME=${e_pref.NAME}" />
You can set environment="" - i.e. an empty prefix - but you would still need the dot to access:
<echo message="NAME=${.NAME}" />
Sorted out the issue.
Somehow netbeans ant does not access environment variables when run in sudo mode.
I didnt find out a solution for that but i settled down with non sudo UI fornetbeans.
Thanx for your valuable time and help.