I am using ant to compile and run a java program, the program is successfully compiled but on running the desired output.txt is not generating. Is something wrong with run command?
COMPILE: ant -buildfile build.xml all
RUN: ant -buildfile build.xml run -Darg0=train_all_txt.txt -Darg1=output.txt
Code in build.xml :
<target name="run" depends="jar">
<java jar="${BUILD}/jar/recommenderSystem.jar" fork="true">
<arg value="${arg0}"/>
<arg value="${arg1}"/>
<arg value="${arg2}"/>
<arg value="${arg3}"/>
<arg value="${arg4}"/>
</java>
</target>
Related
I am using ANT build.xml to generate java proxy class. There i am getting below error.
"[wsimport] [ERROR] Property "Value" is already defined. Use <jaxb:property> to resolve this conflict."
How to perform external binding through ANT build.xml.
Use xjc ANT task
write a bindings (.xjb) to define the appropriate jaxb:property
add -b argument to xjc execution task in ANT.
<arg value="-b"/>
<arg value="bindings.xjb"/>
In linux, I am able to run ldapdelete like this
sudo ldapdelete -x -w 1234 -D "cn=Manager,o=project1" -r "o=project1"
now I want to do this using ANT task:
<target name="ldap-delete">
<exec executable="ldapdelete" failonerror="false">
<arg value="-x"/>
<arg value="-w"/>
<arg value="${ldap.password}"/>
<arg value="-D"/>
<arg value=""${ldap.rootdn}""/>
<arg value="-r"/>
<arg value=""${ldap.entry}""/>
</exec>
</target>
but it failed when running ANT:
[exec] ldap_bind: Invalid DN syntax (34)
[exec] additional info: invalid DN
[exec] Result: 1
what is wrong with my ANT task script?
Thanks
according to martin clayton's comment, I removed quotes around the -D and -r arg values like this:
<arg value="-D"/>
<arg value="${ldap.rootdn}"/>
<arg value="-r"/>
<arg value="${ldap.entry}"/>
and run ant with verbose mode, I got the following error:
[echo] ldapdelete...
[exec] Current OS is Linux
[exec] Executing 'ldapdelete' with arguments:
[exec] '-x'
[exec] '-w'
[exec] '1234'
[exec] '-D'
[exec] 'cn=Manager,o=project1'
[exec] '-r'
[exec] 'o=project1'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[exec] ldap_search: No such object (32)
[exec] ldap_delete: No such object (32)
[exec] Result: 32
ended up with a solution myself:
<target name="ldap-delete">
<exec executable="ldapdelete" failonerror="false">
<arg line="-x -w ${ldap.password} -D "${ldap.rootdn}" -r "${ldap.entry}""/>
</exec>
</target>
I am using Ivy for dependency management in my project. I want to use SLF4J for logging. I added
<dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.5" />
And it downloads both slf4j-log4j12 and slf4j-jdk14, which cause a binding conflict. I tried to exclude it by using
<dependency org="org.slf4j" name="slf4j-log4j12" rev="1.7.5">
<exclude module="slf4j-jdk14" />
</dependency>
But the module is still downloaded. I have put the exclude tag directly under the dependencies tag to exclude this module. Why?
Simplest way to solve this problem is to create a global exclude:
<dependencies>
<dependency ..
<dependency ..
<dependency ..
<exclude org="org.slf4j" module="slf4j-jdk14"/>
</dependencies>
To discover where transitive dependencies come from, I recommend always generating an ivy report:
<target name="resolve" description="Resolve dependencies using ivy">
<ivy:resolve/>
<ivy:report todir="${build.dir}/ivy-report" graph="false"/>
</target>
I was receiving the following error on build in a Visual Studio HTML Application with TypeScript project:
The command "tsc --comments --module AMD --sourcemap --target ES3 " exited with code 1. ProjectName
Problem I had was that the index.ts file was not referenced in the project file.
Fix was to add to ProjectName.csproj:
<ItemGroup>
<TypeScriptCompile Include="index.ts" />
</ItemGroup>
I am trying to setup an ant build script for behat tests so I can run them from jenkins. When I run behat from the command line with bin/behat or ./bin/behat, the output works as expected. But when I use the following ant script
<project name="behat" basedir=".">
<exec dir="bin" executable="./behat">
</exec>
</project>
I get this error:
Buildfile: <mydir>/build.xml
[exec]
[exec]
[exec]
[exec] [RuntimeException]
[exec] Context class not found.
[exec] Maybe you have provided wrong or no `bootstrap` path in your behat.yml:
[exec] http://docs.behat.org/guides/7.config.html#paths
[exec]
[exec]
[exec]
[exec] behat [--init] [-f|--format="..."] [--out="..."] [--lang="..."] [--[no-]ansi] [--[no-]time] [--[no-]paths] [--[no-]snippets] [--[no-]snippets-paths] [--[no-]multiline] [--[no-]expand] [--story-syntax] [-d|--definitions="..."] [--name="..."] [--tags="..."] [--cache="..."] [--strict] [--dry-run] [--rerun="..."] [--append-snippets] [--append-to="..."] [features]
[exec]
[exec]
[exec] Result: 1
BUILD SUCCESSFUL
Total time: 0 seconds
You shouldn't be running behat from the bin directory. It won't find your behat.yml file.
You should either run it like this:
./bin/behat
or pass a path to the config file:
cd bin
./bin/behat --config ../behat.yml
I haven't tried the later. Your ant script might look something like:
<project name="behat" basedir=".">
<exec dir="${basedir}" executable="./bin/behat" />
</project>
I took ant out of the equation and just used jenkins to run the behat commands directly:
cd <mydir>
bin/behat
One thing I need to check is the build from jenkins returns failed, but it may be due to the behat tests are failing.