I am trying to get UMLGraph complied on my MacBook Pro(OSX 10.9.5) and getting an error when trying to run 'ant build.xml'. Has anyone had this issue? Here is the error:
UMLGraph-5.7_2.3-SNAPSHOT$ ant build.xml
Buildfile: /Users/jeremy/UMLGraph-5.7_2.3-SNAPSHOT/build.xml
[echo] git describe --abbrev=6 => 'version'
BUILD FAILED
/Users/jeremy/UMLGraph-5.7_2.3-SNAPSHOT/build.xml:50: The following error occurred while executing this line:
/Users/jeremy/UMLGraph-5.7_2.3-SNAPSHOT/build.xml:27: exec returned: 128
Total time: 1 second
Here is a snip of line 50 and a few lines above it from build.xml:
23 <sequential>
24 <echo message="git describe --abbrev=6 => '#{outputproperty}'"/>
25 <exec executable="git"
26 failonerror="true"
27 outputproperty="#{outputproperty}">
28 <arg value="describe"/>
29 <arg value="--abbrev=6"/>
30 <arg value="HEAD"/>
31 <redirector>
32 <outputfilterchain>
33 <tokenfilter>
34 <replaceregex pattern="R" replace=""/>
35 <replaceregex pattern="_" replace="."/>
36 <replaceregex pattern="-" replace="."/>
37 <replaceregex pattern="(-.*)$" replace="-SNAPSHOT"/>
38 </tokenfilter>
39 </outputfilterchain>
40 </redirector>
41 </exec>
42 <echo message="gitversion returned '${#{outputproperty}}'"/>
43 </sequential>
44 </macrodef>
45
46 <!-- define Maven coordinates; see https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-7c.DeploySnaps hotsandStageReleaseswithAnt -->
47 <property name="groupId" value="org.umlgraph" />
48 <property name="artifactId" value="UmlGraph" />
49 <!-- <property name="version" value="1.0-SNAPSHOT" /> -->
50 <gitversion outputproperty="version"/>
Here are the instructions in the README.txt:
UMLGraph - Declarative Drawing of UML Diagrams
UMLGraph allows the declarative specification and drawing of
UML class and sequence diagrams. You can browse the system's
documentation from the doc/index.html page, or print it from
doc/indexw.html.
To install the elements required to run UMLGraph, simply copy
the contents of the lib directory to a location consistent with
your installation's conventions (for example to /usr/local/lib).
To compile the Java doclet from the source code run ant on the
build.xml file.
If you change the source code, you can run regression tests by
executing "ant test".
Project home page: http://www.umlgraph.org
GitHub page: git#github.com:dspinellis/UMLGraph.git
Diomidis Spinellis - November 2005, August 2008, April 2012
I copied the files from lib/ to /usr/local/lib, like the instructions said, but it appears I am not building it correctly.
Thanks for any help.
In order to get the project compiled you must clone it from GitHub. This is required in order to obtain the version string.
Related
I'm attempting to run a SQL script from within Apache Ant using the execute tag for sqlplus.
<exec dir="src/sql" executable="sqlplus" failonerror="true" output="src/sql/test.sql.err">
<arg value="${db.login}"/>
<arg value="#test.sql"/>
</exec>
Sqlplus is working from the command line using the same arguments.
Ant, however returns:
dyld: Library not loaded: /ade/b/2649109290/oracle/sqlplus/lib/libsqlplus.dylib
For the command line I have set:
export DYLD_LIBRARY_PATH=/Applications/instantclient_11_2/
Is there an equivalent action I need to take for Ant to find the libraries?
One option is to give SQLcl a try.
It's the sql scripting engine from sqldev which is sqlplus , plus a lot more
http://www.oracle.com/technetwork/developer-tools/sqlcl/overview/sqlcl-index-2994757.html
The benefit is there there's no libraries it's self contained and uses the JDBC Thin driver for db connectivity.
Here's your ANT example..
<project name="sqlcl" basedir=".">
<property name="db.login" value="klrice/klrice"/>
<target name="sqlcl">
<exec dir="." executable="/Users/klrice/Downloads/sqlcl/bin/sql"
failonerror="true"
output="sql/test.sql.err">
<arg value="${db.login}"/>
<arg value="#sql/dual.sql"/>
</exec>
</target>
</project>
Then running...
$ ant sqlcl
Buildfile: /Users/klrice/build.xml
sqlcl:
BUILD SUCCESSFUL
Total time: 3 seconds
587211042:~ klrice$ more sql/test.sql.err
SQLcl: Release 17.4.0 Production on Wed Mar 07 21:59:54 2018
Copyright (c) 1982, 2018, Oracle. All rights reserved.
Last Successful login time: Wed Mar 07 2018 22:00:08 -05:00
Connected to:
Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
login.sql found in the CWD. DB access is restricted for login.sql.
Adjust the SQLPATH to include the path to enable full functionality.
1
----------
1
Disconnected from Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
Using the solution #kris-rice suggested, here is my implementation including checking for errors...
<!-- =================================================================== -->
<!-- load plsql tox -->
<!-- =================================================================== -->
<target name="compile.plsql.tox" description="compile plsql for tox">
<echo message="compile.plsql.tox --------------------"/>
<mkdir dir="tmp/log"/>
<exec dir="src/sql" executable="sql" failonerror="true" output="src/sql/tox.all.sql.err">
<arg value="${db.login.tox}"/>
<arg value="#tox.all.sql"/>
</exec>
<echo message="looking for plsql errors -------------------"/>
<exec dir="src/sql" executable="grep" failonerror="false" resultproperty="found">
<arg value="LINE/COL ERROR"/>
<arg value="tox.all.sql.err"/>
</exec>
<fail message="plsql compile errors">
<condition>
<equals arg1="${found}" arg2="0"/>
</condition>
</fail>
<echo message="looking for line item errors ---------------"/>
<exec dir="src/sql" executable="grep" failonerror="false" resultproperty="found">
<arg value="ERROR at"/>
<arg value="tox.all.sql.err"/>
</exec>
<fail message="sql compile errors">
<condition>
<equals arg1="${found}" arg2="0"/>
</condition>
</fail>
<echo message="compile.plsql.tox --------------------"/>
</target>
<!-- =================================================================== -->
I would like to be able to prompt an user for input during the execution of ant.
Pseudo code for what I am trying to do is:
echo "Enter y or n:"
read yorn
if [ $yorn = 'y' ]
then
echo "$yorn" > /tmp/junk
fi
Here is what I have and it does not work:
41 <target name="-after-build">
42 <input message="What's your name?" addproperty="your-name" validargs="Bob,Fred" />
43 <echo>What's up, ${your-name}?</echo>
44 <exec executable="/bin/echo">
45 <arg value="${your-name}"/>
46 <redirector output="/tmp/junk" alwayslog="true"/>
47 </exec>
48 <target name="ask_if_install">
49 <input message="do you want to run rsync?" addproperty="install_it" validargs="y,n" />
50 </target>
51 <target name="install.it"
52 if="install_it"
53 depends="ask_if_install">
54 <exec executable="/bin/echo">
55 <arg value="${install_it}"/>
56 <redirector output="/tmp/junk2" alwayslog="true"/>
57 </exec>
58 </target>
59 </target>
Here is the output that I am getting:
build.xml:48: Problem: failed to create task or type target
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
You can use input task
<project xmlns:if="ant:if" xmlns:unless="ant:unless">
<input message="Enter y or n:" validargs="y,n" addproperty="yes.or.no" />
<condition property="yes.is.true">
<equals arg1="${yes.or.no}" arg2="y" />
</condition>
<concat destfile="junk" if:true="${yes.is.true}">${yes.or.no}</concat>
</project>
EDIT: you can use if:true, if:set, unless:true,... in almost all ant tasks
<exec executable="echo" if:true="${yes.is.true}">
<arg value="${yes.or.no}" />
</exec>
I am trying to execute the "who -m" command from Apache ant without success.
Here is my ant script:
<?xml version="1.0" encoding="UTF-8"?>
<project name="default" default="who.am.i">
<target name="who.am.i">
<exec executable="who" outputproperty="myOutput">
<arg value="-m"/>
</exec>
<echo message="I am = ${myOutput}"/>
</target>
</project>
The result is blank.
[echo] I am =
If I run exec without the argument, it displays the correct result:
<exec executable="who" outputproperty="myOutput">
</exec>
[echo] host.name = gary tty8 2014-02-03 12:04 (:0)
[echo] gary pts/0 2014-02-03 12:09 (:0)
[echo] gary pts/1 2014-02-03 12:23 (:0)
[echo] gary pts/2 2014-02-04 11:36 (:0)
[echo] gary pts/4 2014-02-05 13:27 (:0)
[echo] gary pts/7 2014-02-04 12:23 (:0)
[echo] gary pts/8 2014-02-06 12:44 (:0)
If I run the who -m command from a terminal it displays what I am looking for:
who -m
gary pts/8 2014-02-06 12:44 (:0)
Any ideas why ant is not accepting the -m argument?
Try executing as shell executable to see it that helps. It helps to invoke shell with exact unix command you want to run.
<exec executable="sh" outputproperty="myOutput">
<arg value="who -m"/>
</exec>
You don't mention which flavour of Unix you have, but on Solaris I get this error message when I try your task:
[echo] $ Must be attached to terminal for 'am I' option
In contrast, on OSX it appears to work, but says:
[echo] I am = mjc tty?? Feb 7 02:35
note the ?? - it's also not finding the terminal for the session.
I suspect that in your case it is silently failing for the same reason as the Solaris test - namely that the shell forked by Ant (i.e. by java) isn't associated with your terminal session.
(There may well be a workaround, but I'm not aware of it, and if there is one, it is unlikely to be portable.)
At the end of the day I decided to go another route.
In ~/.bashrc I added the following line:
who -m | awk '{print $5}' > ~/.whoami.out
And to make it global I just added it to /etc/bashrc
This will write to the ~/.whoami.out file every time I log into the remote system.
In my ant script I read the content of this file:
<?xml version="1.0" encoding="UTF-8"?>
<project name="default" default="default">
<target name="test.who.key">
<loadfile property="who.key" srcFile="${user.home}/.whoami.out" failonerror="false"/>
<condition property="who.cond">
<isset property="who.key"/>
</condition>
<condition property="who.cond2">
<not>
<isset property="who.key"/>
</not>
</condition>
</target>
<target name="init.who.key" depends="test.who.key" if="who.cond">
<echo message="WHO EXIST"/>
<property name="whoAmI" value="${who.key}"/>
</target>
<target name="init.not.who.key" depends="test.who.key" if="who.cond2">
<echo message="WHO DOES NOT EXIST"/>
<property name="whoAmI" value=""/>
</target>
<target name="default" depends="init.who.key, init.not.who.key">
<echo message="whoAmI = ${whoAmI}"/>
</target>
</project>
I am trying to use ANT to start a Selenium Grid instance. Using the response found here, How can I run Selenium 2 Grid from an Ant build? , I was able to start the Grid successfully using the following build.xml
<project name="selenium-grid" default="launch-hub" basedir=".">
<property name="selenium.version" value="2.28.0"/>
<property name="sauce.version" value="1.0.8"/>
<path id="selenium.classpath">
<pathelement path="${basedir}/"/>
<fileset dir="${basedir}/">
<include name="selenium-server-standalone-${selenium.version}.jar"/>
<include name="sauce-grid-plugin-${sauce.version}.jar"/>
</fileset>
<pathelement path="${java.class.path}/"/>
</path>
<target name="launch-hub"
description="Launch Selenium Hub">
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="selenium.classpath"
fork="true"
failonerror="true">
<arg value="-role"/>
<arg value="hub"/>
</java>
</target>
</project>
ant launch-hub
Moving on, I would like to use Sauce Labs Grid plug-in with the Selenium Grid which can be found here: https://github.com/rossrowe/sauce-grid-plugin/wiki
Following the wiki, I can start the two on my windows machine using the following from DOS
java -cp selenium-server-standalone-2.25.0.jar;sauce-grid-plugin-1.0.7.jar org.openqa.grid.selenium.GridLauncher -role hub -servlets com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet
Now I want to incorporate the Sauce lab Servlets by adding to the target "launch-hub" to the arguments for the Sauce labs "servlets" (sorry having trouble posting the real code)
arg value="-servlets"
arg value="com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet"
I relaunched using ant launch and here here is the error returned by windows:
launch-hub:
[java] 17 janv. 2013 10:58:40 org.openqa.grid.selenium.GridLauncher main
[java] INFO: Launching a selenium grid server
[java] 17 janv. 2013 10:58:50 org.openqa.grid.web.utils.ExtraServletUtil createServlet
[java] ATTENTION: The specified class : com.saucelabs.grid.SauceOnDemandAdminServlet cannot be instanciated com.sau
celabs.grid.SauceOnDemandAdminServlet
[java] 17 janv. 2013 10:58:50 org.openqa.grid.web.utils.ExtraServletUtil createServlet
[java] ATTENTION: The specified class : com.saucelabs.grid.SauceOnDemandConsoleServlet cannot be instanciated com.s
aucelabs.grid.SauceOnDemandConsoleServlet
[java] 2013-01-17 10:58:50.806:INFO:osjs.Server:jetty-7.x.y-SNAPSHOT
[java] 2013-01-17 10:58:50.866:INFO:osjsh.ContextHandler:started o.s.j.s.ServletContextHandler{/,null}
[java] 2013-01-17 10:58:50.876:INFO:osjs.AbstractConnector:Started SocketConnector#0.0.0.0:4444`enter code here
The Selenium Grid starts but without the servlets, thus no Saucelabs access
Any ideas?
Update Got it working using 1.0.7 of the sauce plugin. No go with version 1.0.8
I was able to get a Grid server running successfully with the Sauce Grid plugin by using your build.xml with the extra arguments, eg
<project name="selenium-grid" default="launch-hub" basedir=".">
<property name="selenium.version" value="2.25.0"/>
<property name="sauce.version" value="1.0.8"/>
<path id="selenium.classpath">
<pathelement path="${basedir}/"/>
<fileset dir="${basedir}">
<include name="selenium-server-standalone-${selenium.version}.jar"/>
<include name="sauce-grid-plugin-${sauce.version}.jar"/>
</fileset>
<pathelement path="${java.class.path}/"/>
</path>
<target name="launch-hub"
description="Launch Selenium Hub">
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="selenium.classpath"
fork="true"
failonerror="true">
<arg value="-servlets"/>
<arg value="com.saucelabs.grid.SauceOnDemandAdminServlet,com.saucelabs.grid.SauceOnDemandConsoleServlet"/>
<arg value="-role"/>
<arg value="hub"/>
</java>
</target>
</project>
From looking at the Selenium Grid code, the error that appeared in the build output is generated when a ClassNotFoundException is thrown...can you check to see if the sauce-grid-plugin jar file is located in the ${basedir}?
I have an exiting ant build that is called via ant -lib lib -f test_build.xml
I wanted to add one more <target> section to be run after the existing one finishes. I did some research and found ant manual for exec and even a question here on SO. After some reading I added new target to this existing build but it didn't work.
I tried to create new build file only with my target. It doesn't work either. Although the ant run finishes with message BUILD SUCCESSFUL
Total time: 0 seconds
If I run my ruby script from a command line it works. I tried to create bat file that would call my ruby script with the same result. If I call the bat file from dos window it works.
My ant run build file looks like
<project name="RunRubyExample">
<target name="calling ruby " >
<exec executable="ruby.exe">
<arg value="C:\EduTester\others\afterant.rb 1 2 tri four"/>
</exec>
</target>
<target name="calling batach">
<exec executable="cmd">
<arg value="/c"/>
<arg value="C:\EduTester\others\rubruby.bat 1 2 tri four"/>
</exec>
</target>
</project>
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
on Windows XP
It looks like you're passing a single arg value with embedded spaces
<arg value="C:\EduTester\others\afterant.rb 1 2 tri four"/>
Is that right? Or should it be either an arg line:
<arg line="C:\EduTester\others\afterant.rb 1 2 tri four"/>
or multiple arg values:
<arg value="C:\EduTester\others\afterant.rb"/>
<arg value="1"/>
<arg value="2"/>
<arg value="tri"/>
<arg value="four"/>
There needs to be specified target that needs to be run
either by <project name="RunRubyExample" default="callingruby">
or when calling the ant build file. Where we pass the target name we want to be run as an argument. ant -lib lib callingruby
Writing a Simple Buildfile
Thank you #Steve