problem while executing script files in linux - izpack

I am trying to create installer for our application using izpack, i am facing problem while executing script file in linux.I am able to run bat files through process panel. please reply

This question would be more easier to answer if you provide a little bit more info here ...
Blind guessing I would say that you need to make sure that the executable bits are preserved on your linux shell scripts using the executable tag like shown below:
<pack name="Tomcat 6 Application Server" required="yes" packImgId="Tomcat.image">
<description>The Tomcat 6.0 Web Application Server.</description>
<fileset dir="windows/apache-tomcat-6.0.32" targetdir="$INSTALL_PATH">
<os family="windows" />
</fileset>
<fileset dir="linux/apache-tomcat-6.0.32" targetdir="$INSTALL_PATH">
<os family="unix" />
</fileset>
<parsable targetfile="$INSTALL_PATH/conf/server.xml" type="xml" />
<parsable targetfile="$INSTALL_PATH/conf/tomcat-users.xml" type="javaprop" />
<parsable targetfile="$INSTALL_PATH/bin/catalina.bat" type="plain" />
<parsable targetfile="$INSTALL_PATH/bin/catalina.sh" type="plain" />
<executable targetfile="$INSTALL_PATH/bin/catalina.sh" keep="true" stage="never" />
<executable targetfile="$INSTALL_PATH/bin/startup.sh" keep="true" stage="never" />
<executable targetfile="$INSTALL_PATH/bin/shutdown.sh" keep="true" stage="never" />
<executable targetfile="$INSTALL_PATH/bin/digest.sh" keep="true" stage="never" />
<executable targetfile="$INSTALL_PATH/bin/setclasspath.sh" keep="true" stage="never" />
<executable targetfile="$INSTALL_PATH/bin/tool-wrapper.sh" keep="true" stage="never" />
<executable targetfile="$INSTALL_PATH/bin/version.sh" keep="true" stage="never" />
</pack>

You can use <executable> tags in your pack definitions
to specify which files are executables. The key is
to have stage="never" attribute so izpack does not execute
the file and to set keep="true" so izpack does not remove it.
For example:
<executable targetfile="$INSTALL_PATH/bin/some-secript"
os="unix" stage="never" failure="warn" keep="true"/>
documentation
[izpack-user] Setting file-permissions in Linux

Related

Apache Ant 1.9.1 build.xml works fine with windows but throwing error with Linux

I am trying to run my build.xml file. In windows its running fine but when i try to run the same build.xml in linux it throws below error
/ATG/TwoDegreeReplatformApp/twodegree/build/build.xml:4: The following error occurred while executing this line:
jar:file:/ATG/apache-ant-1.9.4/lib/ant.jar!/org/apache/tools/ant/antlib.xml:37: Problem: failed to create task or type componentdef
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.
Even i have checked the path variable in linux machine. Last week same script was working in Linux env but now started throwing error.
Below is my build file
<?xml version="1.0" encoding="UTF-8"?>
<project name="Siebel" default="all-with-ws" basedir=".">
<!-- Import global defaults and settings and common tasks -->
<import file="${basedir}/buildtools/common.xml"/>
<!-- To keep track of alters made to the schemas, place them in the sql.install.dir
and name them with alter_core_xxx.sql and alter_catalog_xxx.sql. The following
path declaration will pick them up, and they will be executed on the appropriate
schema. -->
<path id="alter.core.schema.files">
<fileset dir="${sql.alter.dir}">
<include name="alter_core*"/>
</fileset>
</path>
<path id="alter.catalog.schema.files">
<fileset dir="${sql.alter.dir}">
<include name="alter_catalog*"/>
</fileset>
</path>
<!-- ======================================= -->
<!-- Task Definitions -->
<!-- ======================================= -->
<!-- Web Serice import task - generates Java classes based on WSDL files.
This is a JAX (Java API for XML) resource.
-->
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath refid="classpath"/>
<classpath path="${dyn.classpath}" />
</taskdef>
<!-- ======================================= -->
<!-- Define the all task. We do this here because we need to call tasks
imported in both the common.xml and deploy.xml files. This may seem a
bit odd but it feels better to segregate common tasks from j2ee
deployment tasks and add this extra bit of layering than have one
massive common task file which has tons of targets, making it difficult
to read. You get my point separating the tasks in multiple imports
makes this complex environment easier to get around. -->
<target name="all"
depends="clean,build,install"
description="Cleans, builds, and installs the project.">
</target>
<!-- Does what 'all' does.
Also builds and install the web services for the "import from Siebel"
functionality.
-->
<target name="all-with-ws"
depends="clean,build,install,make-install-ws"
description="Cleans, builds, and installs the project.">
</target>
<!--
Compiles and jars the code.
Also copies the WSDL files into the classes dir to the JAR'd.
-->
<target name="build"
depends="set-dynamo-classpath,wsdl2java,compile,copy-wsdl,-jar,-copylibs,build-versioned,build-publishingagent"
description="Compiles and jars the code.">
</target>
<!-- Performs all requisite tasks for installing the module.
-->
<target name="install"
depends="-init, -createdirs, -installcore, -install-web-app,install-versioned,install-publishingagent"
description="Installs the codebase to the install directory.">
</target>
<!--
Creates and installs the Siebel web services.
-->
<target name="make-install-ws"
depends="create-ws,install-ws"
description="" >
</target>
<!--
Creates the Siebel web service.
-->
<target name="create-ws">
<antcall target="copy-siebel-ws-script" />
<exec executable="/bin/sh" dir="${dynamo.home}" failonerror="yes"
os="Linux:SunOS:Mac OS X">
<arg line="bin/generateSiebelWebService" />
</exec>
<exec executable="cmd" dir="${dynamo.home}" failonerror="yes"
osfamily="windows">
<arg line="/c bin\generateSiebelWebService.bat" />
</exec>
<move todir="${basedir}/SiebelWS/j2ee-apps" failonerror="yes">
<fileset dir="${dynamo.home}" includes="SiebelWS.ear" />
</move>
</target>
<!--
Copies the web service generation scripts to $DYNAMO_HOME/bin
so they have access to other ATG scripts.
-->
<target name="copy-siebel-ws-script">
<copy todir="${dynamo.home}/bin" failonerror="yes">
<fileset dir="${basedir}/wsGenScripts/" includes="generate*" />
</copy>
</target>
<!--
Installs the web services by copying them to the module directory.
-->
<target name="install-ws" >
<!-- Copy the web service directory -->
<copy todir="${install.dir}/SiebelWS">
<fileset dir="${basedir}/SiebelWS/"/>
</copy>
</target>
<!--
Copy WSDL files into classes dir
-->
<target name="copy-wsdl">
<copy todir="${classes.dir}/META-INF/wsdl">
<fileset dir="${src.dir}/META-INF/wsdl"/>
</copy>
</target>
<!--
Creates Java source from the WSDL files provided.
Calls another task to pass in the right classpath.
-->
<target name="wsdl2java">
<antcall target="_wsdl2java" />
</target>
<!--
Creates Java source from the WSDL files provided.
This must be called from an antcall in order to get the right classpath.
-->
<target name="_wsdl2java" depends="set-dynamo-classpath">
<echo>${gen-src.dir}</echo>
<echo>${classes.dir}</echo>
<mkdir dir="${gen-src.dir}" />
<mkdir dir="${classes.dir}" />
<property name="quiet" value="true"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/SelfServiceAccount.wsdl"
wsdllocation="http://localhost/wsdl/SelfServiceAccount.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/SelfServiceAddress.wsdl"
wsdllocation="http://localhost/wsdl/SelfServiceAddress.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/SelfServiceContact.wsdl"
wsdllocation="http://localhost/wsdl/SelfServiceContact.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/SelfServiceUser.wsdl"
wsdllocation="http://localhost/wsdl/SelfServiceUser.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/ProductConfigurator.wsdl"
wsdllocation="http://localhost/wsdl/ProductConfigurator.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/PromotionWebService.wsdl"
wsdllocation="http://localhost/wsdl/PromotionWebService.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/CalculatePriceWS.wsdl"
wsdllocation="http://localhost/wsdl/CalculatePriceWS.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/SelfServiceAccountBillingProfile.wsdl"
wsdllocation="http://localhost/wsdl/SelfServiceAccountBillingProfile.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/QuotingWebService.wsdl"
wsdllocation="http://localhost/wsdl/QuotingWebService.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/OrderDetailWebService.wsdl"
wsdllocation="http://localhost/wsdl/OrderDetailWebService.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/OrderWebService.wsdl"
wsdllocation="http://localhost/wsdl/OrderWebService.wsdl"/>
<wsimport keep="true"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/AssetManagement.wsdl"
wsdllocation="http://localhost/wsdl/AssetManagement.wsdl"/>
<wsimport keep="true"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/AssetManagementComplex.wsdl"
wsdllocation="http://localhost/wsdl/AssetManagementComplex.wsdl"/>
<wsimport keep="true" quiet="${quiet}"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/QuoteEligibilityCompatibility.wsdl"
wsdllocation="http://localhost/wsdl/QuoteEligibilityCompatibility.wsdl"/>
<wsimport keep="true"
sourcedestdir="${gen-src.dir}" destdir="${classes.dir}"
wsdl="${wsdl.dir}/CatalogWebService.wsdl"
wsdllocation="http://localhost/wsdl/CatalogWebService.wsdl"/>
</target>
<!-- Installs the JSP files to the target WAR directory.
-->
<target name="install-jsps" description="Copy JSPs">
<filter token="*.js*" value="${install.dir}/j2ee-apps/Siebel/siebel.war" />
<copy todir="${install.dir}/j2ee-apps/Siebel/siebel.war" preservelastmodified="true" filtering="true" encoding="ISO-8859-1">
<fileset dir="${basedir}/j2ee/siebel.war" />
</copy>
</target>
<target name="-install-web-app" description="Installs all module's web applications into installation directory.">
<!-- Copy config files only and apply filtering to them. -->
<copy todir="${install.j2ee.dir}/${module.name}">
<fileset dir="${j2ee.dir}"/>
</copy>
<!-- Copy all necessary taglibs into each target WEB-INF directory. -->
<foreach param="target.webinf.dir" target="-copy-taglibs">
<path>
<dirset dir="${install.j2ee.dir}/${module.name}">
<include name="**/WEB-INF"/>
</dirset>
</path>
</foreach>
</target>
<target name="build-versioned"
depends="set-dynamo-classpath"
description="Builds the Java code in the Versioned sub-module">
<mkdir dir="${classes.versioned.dir}" />
<echo message="DYNAMO CLASSPATH = ${dyn.classpath}"/>
<property name="prop.classpath" refid="classpath" />
<echo message="CLASSPATH = ${prop.classpath}"/>
<javac srcdir="${src.versioned.dir}"
destdir="${classes.versioned.dir}"
debug="true"
deprecation="false"
optimize="false"
source="1.5"
target="1.5"
includeantruntime="false"
verbose="${javac.verbose.bool}">
<classpath refid="classpath"/>
<classpath path="${dyn.classpath}"/>
<classpath path="${classes.dir}"/>
<include name="**/*.java" />
</javac>
<!-- create classes.jar -->
<mkdir dir="${build.versioned.dir}/lib" />
<jar jarfile="${build.versioned.dir}/lib/classes.jar"
basedir="${classes.versioned.dir}/"
includes="**"/>
<!-- copy config files -->
<mkdir dir="${build.tempconfig.versioned.dir}" />
<copy todir="${build.tempconfig.versioned.dir}" filtering="true">
<fileset dir="${config.versioned.dir}" />
</copy>
</target>
<target name="install-versioned" description="Installs the Versioned sub-module">
<!-- copy classes.jar -->
<mkdir dir="${build.versioned.dir}/lib"/>
<copy file="${build.versioned.dir}/lib/classes.jar" todir="${install.versioned.dir}/lib"/>
<!-- copy config files -->
<mkdir dir="${install.versioned.dir}/config" />
<copy todir="${install.versioned.dir}/config">
<fileset dir="${build.tempconfig.versioned.dir}" />
</copy>
<!-- Copy manifest file -->
<mkdir dir="${install.versioned.dir}/META-INF" />
<copy file="${versioned.dir}/META-INF/MANIFEST.MF" todir="${install.versioned.dir}/META-INF"/>
</target>
<target name="build-publishingagent"
depends="set-dynamo-classpath"
description="Builds the publishingagent sub-module">
<mkdir dir="${classes.publishingagent.dir}" />
<echo message="DYNAMO CLASSPATH = ${dyn.classpath}"/>
<property name="prop.classpath" refid="classpath" />
<echo message="CLASSPATH = ${prop.classpath}"/>
<javac srcdir="${src.publishingagent.dir}"
destdir="${classes.publishingagent.dir}"
debug="true"
deprecation="false"
optimize="false"
source="1.5"
target="1.5"
includeantruntime="false"
verbose="${javac.verbose.bool}">
<classpath refid="classpath"/>
<classpath path="${dyn.classpath}"/>
<classpath path="${classes.dir}"/>
<include name="**/*.java" />
</javac>
<!-- create classes.jar -->
<mkdir dir="${build.publishingagent.dir}/lib" />
<jar jarfile="${build.publishingagent.dir}/lib/classes.jar"
basedir="${classes.publishingagent.dir}/"
includes="**"/>
<!-- copy config files -->
<mkdir dir="${build.tempconfig.publishingagent.dir}" />
<copy todir="${build.tempconfig.publishingagent.dir}" filtering="true">
<fileset dir="${config.publishingagent.dir}" />
</copy>
</target>
<target name="install-publishingagent" description="Installs the PublishingAgent sub-module">
<!-- copy classes.jar -->
<mkdir dir="${build.publishingagent.dir}/lib"/>
<copy file="${build.publishingagent.dir}/lib/classes.jar" todir="${install.publishingagent.dir}/lib"/>
<!-- copy config files -->
<mkdir dir="${install.publishingagent.dir}/config" />
<copy todir="${install.publishingagent.dir}/config">
<fileset dir="${build.tempconfig.publishingagent.dir}" />
</copy>
<!-- Copy manifest file -->
<mkdir dir="${install.publishingagent.dir}/META-INF" />
<copy file="${publishingagent.dir}/META-INF/MANIFEST.MF" todir="${install.publishingagent.dir}/META-INF"/>
</target>
</project>
The ANT error indicates that your build is missing jars required by a 3rd party ANT task.
The following documentation describes the wsimport task:
https://jax-ws.java.net/2.2.3/docs/wsimportant.html
States the external task is declared as follows:
<taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath
path="jaxws.classpath"/>
</taskdef>
With the following description of the classpath:
where jaxws.classpath is a reference to a path-like structure, defined
elsewhere in the build environment, and contains the list of classes
required by the JAX-WS tools.
So looks like you need to doublecheck the path declaration in your build and ensure that the JAX-WS jars are installed.
There's missing information in your build.xml file:
<import file="${basedir}/buildtools/common.xml"/>
Much of your build.xml is embedded in that common.xml file. You listed your entire build.xml, but not that file.
For example, your taskdef depends upon classpath being set, and ${dyn.classpath} being defined. They're not defined in your build.xml file. You also use foreach which I assume comes from the Ant Contrib jar, but the <taskdef> from your build.xml doesn't contain that either.
I suspect that your Windows Ant may contain third party jars in $ANT_HOME/lib, or that other setup issues may exist that you depend upon on your Windows machine, but aren't in that Linux machine.

ant junit selenium wont run in jenkins

I have junit tests that use selenium to test web server.
When i run the tests using ant from command line, everything is working fine, browser gets opened and tests are going as planed.Browser gets open and i can see tests running.
Recently ive tried to add automatic tests as part of Ci cycle running on jenkins.
I run it as ant build command.
I can see that ant is executing properly (test classes are built i can see output from tests to console) but browser window never gets opened and test fails because of it. here is my ant file
<?xml version="1.0"?>
<project name="JUNIT" default="main" basedir="../../project" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<!-- Sets variables which can later be used. -->
<!-- The value of a property is accessed via ${} -->
<property name="api.dir" location="src/java" />
<property name="build.api.dir" location="target/classes" />
<property name="test.dir" location="src/test/java" />
<property name="build.test.dir" location="target" />
<!-- Variables used for JUnit testin -->
<property name="test.report.dir" location="testreport" />
<!-- Define the classpath which includes the junit.jar and the classes after compiling-->
<path id="api.class.path">
<pathelement location="${build.api.dir}" />
</path>
<artifact:dependencies cacheDependencyRefs="true" pathId="pomdeps.path">
<pom file="pom.xml"/>
</artifact:dependencies>
<target name="clean">
<delete dir="${test.report.dir}" />
<delete dir="${build.api.dir}" />
<delete dir="${build.test.dir}" />
</target> <!-- Creates the build, docs and dist directory-->
<target name="makedir">
<echo message="Make dir"/>
<mkdir dir="${build.test.dir}" />
<mkdir dir="${build.api.dir}" />
<mkdir dir="${test.report.dir}" />
</target> <!-- Compiles the java code (including the usage of library for JUnit -->
<target name="compile" depends="clean, makedir">
<echo message="Compile"/>
<javac srcdir="${api.dir}" destdir="${build.api.dir}" includeantruntime="false">
<!--classpath refid="junit.class.path" />
<classpath refid="libs.class.path" /-->
<classpath refid="pomdeps.path" />
</javac>
<javac srcdir="${test.dir}" destdir="${build.test.dir}" includeantruntime="false">
<!--classpath refid="junit.class.path" /-->
<classpath refid="api.class.path" />
<classpath refid="pomdeps.path" />
</javac>
</target>
<!-- Run the JUnit Tests --> <!-- Output is XML, could also be plain-->
<echo message="Classes folder ${build.test.dir}"/>
<target name="junit" depends="compile" >
<echo message="junit"/>
<junit printsummary="on" fork="false" haltonfailure="no" showoutput="true">
<classpath refid="pomdeps.path" />
<classpath>
<pathelement location="${build.test.dir}"/>
<pathelement location="${build.api.dir}"/>
</classpath>
<formatter usefile="false" type="plain"/>
<batchtest fork="no" todir="${test.report.dir}">
<fileset dir="${test.dir}">
<include name="**/*Test*.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="main" depends="compile, junit">
<description>Main target</description>
</target>
</project>
Jenkins is 1.591 i installed it with default parameters as windows installation downloaded from their site.
Can it be something wrong with jenkins? Do i miss something?
As i mentioned earlier the problem was lack of UI permissions for Jenkins server.
1.configure Jenkins to run as service and make it login with real user name
2.Make sure that windows host that runs Jenkins logs on automaticaly after restart.

Sonar Integration Tests Coverage not show + Selenium + Jboss +Jacoco

I use Sonar 4.1.1, Jboss 6.x, Jacoco 0.6.4, execute tasks with Ant I am not allowed to use Maven. In an eclipse workspace, I have two projects, one is the web application another is selenium test.
I am able to get unit test and code coverage for unit test. But sonar is not able to read the integration test file created by Jacoco. I think there might be something wrong with the way I create jacoco-it.exec file so sonar can't read it. Because sonar does read my jacoco-ut.exec file. And I am able to have both reportPath and itReportPath to read my jacoco-ut.exec file with no problem. Also thinking maybe is something wrong in my build file. I did a lot of research and tried many different ways to create the jacoco-it.exec file, different Jacoco settings and followed different examples from sonar, jacoco, other blogs but still doesn't work. I must be missing something Help!! Thanks!!
I have VM arguments for Jboss like this
-javaagent:/path to jar/jacocoagent.jar=destfile=/path for create/jacoco-it.exec
When I run selenium, the above code create a file with some data, size about 1.3MB
Here is the part of build relate to this issue
<property name="sonar.sourceEncoding" value="UTF-8" />
<property name="sonar.java.coveragePlugin" value="jacoco" />
<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<property name="sonar.dynamicAnalysis" value="reuseReports" />
<property name="sonar.jacoco.reportsPath" value="${reports.dir}/junit" />
<property name="sonar.jacoco.itReportPath" value="${reports.dir}/jacoco-it.exec" />
<property name="sonar.jacoco.reportPath" value="${reports.dir}/jacoco-ut.exec" />
<target name="unitTest" depends="compile">
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
<path refid="classpath"/>
</classpath>
</taskdef>
<!-- Import the JaCoCo Ant Task -->
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath refid="classpath"/>
</taskdef>
<!-- Run your unit tests, adding the JaCoCo agent -->
<jacoco:coverage destfile="reports/jacoco-ut.exec" xmlns:jacoco="antlib:org.jacoco.ant">
<junit printsummary="yes" haltonfailure="yes" forkmode="once" fork="true" dir="${basedir}" failureProperty="test.failed">
<classpath location="${classes.dir}" />
<classpath refid="classpath"/>
<formatter type="plain" />
<formatter type="xml" />
<batchtest fork="true" todir="${reports.junit.xml.dir}">
<fileset dir="src">
<include name="**/*TestAdd.java" />
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
</target>
<target name="coverageTest" depends="compile">
<taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
<classpath>
<path refid="classpath"/>
</classpath>
</taskdef>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath refid="classpath"/>
</taskdef>
<!--Run your unit tests, adding the JaCoCo agent-->
<jacoco:coverage xmlns:jacoco="antlib:org.jacoco.ant" dumponexit="true" >
<junit printsummary="yes" haltonfailure="yes" forkmode="once" fork="true" dir="${basedir}" failureProperty="test.failed">
<classpath location="${classes.dir}"/>
<classpath refid="classpath"/>
<formatter type="plain" />
<formatter type="xml" />
<formatter type="plain" usefile="false"/>
<batchtest todir="${reports.junit.xml.dir}">
<fileset dir="../HelloAppTest/src">
<include name="**/answerTest.java"/>
</fileset>
</batchtest>
</junit>
</jacoco:coverage>
</target>
The reason for that is, may be you are NOT attaching Jacocoagent.jar file to the "TARGET" (ex: JBoss / Tomcat) JVM's scope and stopping it so that it can flush the final code coverage data to the jacoco it exec file.
Once you do that (instead of using Maven/ANT's JVM scope), run your non-Unit (IT) tests and then STOP the target JVM.
After the target JVM is stopped, you'll get the final jacoco .exec file genreated for the IT tests. Use that file for sonar.jacoco.itReportPath variable and it'll work.
For ex: I pass/have this variable to the Tomcat's startup.sh script and while starting tomcat (target JVM), I use this variable within the Tomcat's actual start command.
PROJ_EXTRA_JVM_OPTS=-javaagent:tomcat/jacocoagent.jar=destfile=build/jacoco/IT/jacocoIT.exec,append=false

Getting Nant.MailLogger to work on Windows 2008

I have had a NAnt/NAntContrib build running for a while on one machine:
(MS Windows Server 2003 Standard 32-bit SP2)
And I now need to run the same build script on a newer machine:
(Windows Server Standard 2008)
I have gotten NAnt and NAnt.Config installed and working on the new machine.
I am using NAnt.Core.Maillogger on the original machine, configured as such:
<property name="MailLogger.mailhost" value="mail.server.com" />
<property name="MailLogger.from" value="autobuild#hostredacted.com" />
<property name="MailLogger.failure.notify" value="true" />
<property name="MailLogger.success.notify" value="true" />
<property name="MailLogger.failure.to" value="team#hostredacted.com" />
<property name="MailLogger.success.to" value="team#hostredacted.com" />
<property name="MailLogger.failure.subject" value="AUTOBUILD: Failure on TEST" />
<property name="MailLogger.success.subject" value="AUTOBUILD: Success on TEST" />
<property name="MailLogger.failure.attachments" value="MailLogger.failure.files" />
<property name="MailLogger.success.attachments" value="MailLogger.success.files" />
<fileset id="MailLogger.failure.files">
<include name="build.log" />
</fileset>
<fileset id="MailLogger.success.files">
<include name="build.log" />
</fileset>
I run a very simple test .build file, to test mail functionality:
<target name="test_mail_pass">
<echo message="Test Success:
run by ${environment::get-user-name()}"/>
</target>
<target name="test_mail_fail">
<echo message="Test Fail:
run by ${environment::get-user-name()}"/>
<fail message="Some Failure occurred." />
</target>
The above works on the original machine, and seems to work on the new machine, except for the fact that no mail is sent.
There is no message in the console that indicates that anything went wrong (ignoring the obvious use of the <fail> task).
I don't even know where to begin figuring out what is wrong here, or how to troubleshoot this problem.
Any assistance would be greatly appreciated.
I have solved this problem with much Google-ing.
One of two things solved my problem, and I don't know which it was, but my problem is now solved.
My batch file needed to have the following command-line option:
-logger:NAnt.Core.MailLogger
The file that was referred to in the:
<fileset id="MailLogger.failure.files">
<include name="build.log" />
</fileset>
<fileset id="MailLogger.success.files">
<include name="build.log" />
</fileset>
Need to actually exist.
One post I read (lost the link) told of a problem where if the files to attach do not exist, the Mail will just not get sent.

How can I apply all the sql files in a directory?

We currently run a specific SQL script as part of our Ant deploy process.
What we'd like to do is change this so we run all SQL scripts in a given directory. We can't figure out how to get this directory listing in Ant and iterate through the list and run each SQL script. Does anyone know how to do this?
Note: we currently run the sql file by using the Ant exec task that runs "call sqlplus ${id}/${pw}#${db.instance} #${file}"
I would recommend using the Ant SQL task. You can then specify with the following:
<sql
driver="org.database.jdbcDriver"
url="jdbc:database-url"
userid="sa"
password="pass">
<path>
<fileset dir=".">
<include name="data*.sql"/>
</fileset>
<path>
</sql>
i am doing basically the same thing on an oracle database.. but using sqlplus and the apply task. this allows the scripts to contain DDL statements.
would obviously only work where you have a command line program to use.
using ant 1.8.2 and antcontrib.
i have defined a few macros for use.. (see below) and then just call like
<compile_sql connectstring="${db.connect_string}" >
<filelist dir="${db_proc.dir}" files="specific_file.sql" />
<fileset dir="${db_proc.dir}" includes="wildcard*.pks" />
<fileset dir="${db_proc.dir}" includes="wildcard*.pkb" />
</compile_sql>
the macros are as follows
<macrodef name="compile_sql">
<attribute name="connectstring" />
<attribute name="dirtostart" default=""/>
<attribute name="arg1" default=""/>
<element name="sqllist" implicit="true" description="filesetlist of sql to run"/>
<sequential>
<check_missing_files>
<sqllist/>
</check_missing_files>
<apply executable="${sqlplus.exe}" failonerror="true" verbose="true" skipemptyfilesets="true" ignoremissing="false" dir="#{dirtostart}">
<arg value="-L"/>
<arg value="#{connectstring}"/>
<srcfile prefix="#" />
<sqllist/>
<arg value="#{arg1}"/>
<redirector>
<globmapper id="sqlout.mapper"
from="*"
to="*.out"/>
</redirector>
</apply>
</sequential>
</macrodef>
and
<macrodef name="check_missing_files">
<element name="checkfilelist" implicit="true" description="filelist of files to check for existance"/>
<sequential>
<restrict id="missing.files" xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
<resources>
<checkfilelist/>
</resources>
<rsel:not>
<rsel:exists/>
</rsel:not>
</restrict>
<fail message="These files are missing: ${ant.refid:missing.files}" >
<condition >
<length string="${ant.refid:missing.files}" when="greater" length="0" />
</condition>
</fail>
</sequential>
</macrodef>