I have just upgraded to v 5.0.0-beta11 of izPack.
I have updated my configuration so the compiler works.
However, the output jar file throws the following error....
Could not find or load main class
com.izforge.izpack.installer.bootstrap.Installer
Any suggestions on what I may have missed?
<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
<installation version="5.0"
xmlns:izpack="http://izpack.org/schema/installation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://izpack.org/schema/installation http://izpack.org/schema/5.0/izpack-installation-5.0.xsd">
<info>
<appname>appname (2013-09-03)</appname>
<appversion>20130903_1115</appversion>
<url>http://google.com</url>
<authors>
<author name="steven" email="sbirdranch#yahoo.com"/>
</authors>
<uninstaller write="no"/>
</info>
<run-privileged condition="izpack.windowsinstall.vista|izpack.windowsinstall.7"/>
<guiprefs width="700" height="550" resizable="no">
<modifier key="useButtonIcons" value="no"/>
<modifier key="useLabelIcons" value="no"/>
<modifier key="labelGap" value="2"/>
<modifier key="layoutAnchor" value="NORTHWEST"/>
<modifier key="useHeadingPanel" value="yes"/>
<modifier key="headingImageOnLeft" value="no"/>
<modifier key="headingLineCount" value="1"/>
<modifier key="headingFontSize" value="1.5"/>
<modifier key="headingBackgroundColor" value="0x00ffffff"/>
</guiprefs>
<locale>
<langpack iso3="eng"/>
</locale>
<resources>
<res id="HTMLLicencePanel.licence" src="./packager/pack_license.htm"/>
<res id="HTMLHelloPanel.hello" src="./packager/pack_welcome.htm"/>
<res id="Installer.image" src="./packager/pb_wizSplash.png"/>
<res id="Heading.image" src="./packager/tdkc_gradient.png"/>
<res id="userInputSpec.xml" src="./packager/userInputSpec.xml"/>
<res id="TargetPanel.dir" src="./packager/installDir.txt"/>
</resources>
<variables>
<variable name="ShowCreateDirectoryMessage" value="false"/>
</variables>
<conditions>
<condition type="variable" id="checkBox">
<name>ackVar</name>
<value>on</value>
</condition>
<condition type="or" id="isCheckedCondition">
<condition type="ref" refid="checkBox"/>
</condition>
</conditions>
<panels>
<panel classname="HTMLHelloPanel" id="helloPanel"/>
<panel classname="HTMLLicencePanel" id="licPanel"/>
<panel classname="UserInputPanel" id="ackSBIRPanel">
</panel>
<panel classname="TargetPanel" id="targetPanel"/>
<panel classname="InstallPanel" id="installPanel"/>
</panels>
<packs>
<pack name="UDK Core" required="yes">
<description>Core files </description>
<file src="c:\BUILD_AREA\Build_Tester/tempZip/Build_Tester_20130903_1115_X-win32.win32.x86_64/Build_Tester_Archive_Prefix" targetdir="$INSTALL_PATH"/>
</pack>
</packs>
</installation>
Could not find or load main class com.izforge.izpack.installer.bootstrap.Installer
i'd first check build.xml to see if the izpack-installer-5.0.0-beta11.jar is included in the classpath or not.
<project default="install">
<path id="build.classpath">
<fileset dir="${DEFAULT_IZPACK_HOME}">
<include name="lib/*.jar" />
</fileset>
</path>
Related
Please help, errors occur when I run build with ant, and I'm new to apache ant.
My project composes of two modules, this build.xml is my main project build file, and dependency module is set within the path label.
My build.xml:
<?xml version="1.0" encoding="utf-8"?>
<project name="GameServer" basedir=".">
<property name="build.dir" value="bin" />
<property name="lib.dir" value="lib" />
<property name="dist.dir" value="dist" />
<property name="source.dir" value="src" />
<property name="web.dir" value="WebContent" />
<property name="TODAY" value="2019-09-10"/>
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<path location="D:\backend\worldAndBattle\trunk\worldAndBattle" />
</path>
<!-- 初始化 -->
<target name="init" description="Prepare for build">
<mkdir dir="${dist.dir}" />
<mkdir dir="${build.dir}" />
</target>
<!-- 清理 -->
<target name="clean" description="Clean all build products">
<delete dir="${dist.dir}" quiet="true"/>
<delete dir="${build.dir}" quiet="true"/>
</target>
<!-- 编译代码 -->
<target name="compile" description="Compile application" depends="clean, init">
<javac srcdir="${source.dir}"
destdir="${build.dir}"
includes="**/*.java"
debug="on"
deprecation="on"
source="1.7"
includeAntRuntime="false">
<classpath refid="classpath" />
</javac>
</target>
<!-- 打包sql -->
<target name="sql">
<jar destfile="${build.dir}/sql.jar">
<fileset dir="${source.dir}"
includes="**/sql.xml,
**/*.properties"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<!-- 打包game -->
<target name="game" depends="compile, sql" >
<jar destfile="${dist.dir}/game.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="com/bianfeng/game/hotswap/*,
**/*Test.class,
**/Foo.class,
**/applicationContext.xml, **/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml"
/>
<fileset dir="${source.dir}"
includes="**/*.properties"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
<attribute name="Main-Class" value="com.bianfeng.game.Main" />
</manifest>
</jar>
</target>
<!-- 打包game -->
<target name="game-with-application" depends="compile, sql" >
<jar destfile="${dist.dir}/game.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="com/bianfeng/game/hotswap/*,
**/*Test.class,
**/Foo.class,
**/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
<target name="game-cross" depends="compile, sql" >
<jar destfile="${dist.dir}/game-cross.jar">
<fileset dir="${build.dir}"
includes="**/*"
excludes="**/*Test.class,
**/Foo.class,
**/*.js, log4j.properties, logback.xml, conf.xml,
**/sql.xml,
**/*Action.class,
**/*Dao.class
"
/>
<manifest>
<attribute name="Author" value="${user.name}" />
<attribute name="Implementation-Date" value="${TODAY}" />
</manifest>
</jar>
</target>
</project>
and, I am attaching an image with my errors.
When I run compile, I get errors. And I don't know what should I do?
I am trying to test SOA through Ant Scripts in Jenkins. I am able to run the test of ant script in my PC but when I try to create the same in Jenkins job it fails.
The same command runs fine when I directly run in PC with Ant scripts.
Ant command for deploy works well but the ant test is giving me challenge.
Command below
ant -f ant-sca-test.xml -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:/12c_Ant/ant_soa/jndi.properties
Below is the error message.
No changes for http://code.sunpowercorp.com/middleware-repo/fmw_12c/code/trunk/TestSOAAdd since the previous build
[ant_soa] $ cmd.exe /C "D:\Jdev1221\Middleware\Oracle_Home\oracle_common\modules\org.apache.ant_1.9.2\bin\ant.bat -file ant-sca-test.xml -DCompositeName=TestSOAAdd -DSVNCodePath=TestSOAAdd -Dtargetenv=proj ant-sca-test.xml -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:\12c_Ant\ant_soa\jndi.properties && exit %%ERRORLEVEL%%"
Buildfile: D:\12c_Ant\ant_soa\ant-sca-test.xml
[echo] Running scatest using oracle.home = D:\Jdev1221\Middleware\Oracle_Home
BUILD FAILED
Target "ant-sca-test.xml" does not exist in the project "ant-scactest".
Ant Test file below:
<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="ant-scactest" default="test">
<!-- must have these properties available
-->
<!-- oracle.home -->
<condition property="oracle.home" value="D:\Oracle\Middleware\Oracle_Home">
<not><isset property="oracle.home"/></not>
</condition>
<fail message="oracle.home is not available. Please provide this property.">
<condition>
<not>
<isset property="oracle.home"/>
</not>
</condition>
</fail>
<import file="ant-soa-common.xml"/>
<property environment="env"/>
<fail message="JAVA_HOME is not available. Please provide this property.">
<condition>
<and>
<not>
<isset property="env.JAVA_HOME"/>
</not>
<not>
<isset property="java.passed.home"/>
</not>
</and>
</condition>
</fail>
<condition property="java.passed.home" value="${env.JAVA_HOME}">
<isset property="env.JAVA_HOME"/>
</condition>
<condition property="scatest.format" value="native">
<not>
<isset property="scatest.format"/>
</not>
</condition>
<condition property="scatest.result" value="${java.io.tmpdir}/out">
<not>
<isset property="scatest.result"/>
</not>
</condition>
<condition property="scatest.timeout" value="300">
<not>
<isset property="scatest.timeout"/>
</not>
</condition>
<property name="scatest.partition" value="default"/>
<!-- if wl_home is not provided use the default -->
<condition property="wl_home" value="${mw.home}/wlserver">
<not>
<isset property="wl_home"/>
</not>
</condition>
<!-- jars needed to run scatest ant task -->
<path id="scatest.tasks.class.path">
<fileset dir="${mw.home}/soa/soa/modules/oracle.soa.fabric_11.1.1">
<include name="fabric-runtime.jar"/>
<include name="fabric-ext.jar"/> <include name="oracle-soa-client-api.jar"/>
</fileset>
<fileset dir="${oracle.soa.mgmt.home}/soa/modules/oracle.soa.mgmt_11.1.1">
<include name="soa-infra-mgmt.jar"/>
</fileset>
<fileset dir="${mw.home}/soa/soa/modules/oracle.soa.bpel_11.1.1">
<include name="orabpel.jar"/>
<include name="orabpel-common.jar"/>
</fileset>
<pathelement location="${wl_home}/server/lib/weblogic.jar" />
<pathelement location="${wl_home}/server/lib/wlclient.jar" />
<fileset dir="${common.components.home}/modules">
<include name="oracle.jps/jps-api.jar"/>
<include name="oracle.jps/jps-internal.jar"/>
<include name="oracle.jps/jps-common.jar"/>
<include name="oracle.jrf/jrf-api.jar"/>
</fileset>
<!-- was specific files -->
<pathelement location="${oracle.soa.mgmt.home}/soa/modules/oracle.soa.mgmt_11.1.1/soa-client-stubs-was.jar"/>
<pathelement location="${was.home}/runtimes/com.ibm.ws.ejb.thinclient_8.0.0.jar"/>
<pathelement location="${was.home}/runtimes/com.ibm.ws.orb_8.0.0.jar"/>
<pathelement location="${was.home}/plugins/com.ibm.ws.runtime.jar"/>
<pathelement location="${was.home}/runtimes/com.ibm.ws.admin.client_8.0.0.jar"/>
<!--
<pathelement location="${was.home}/runtimes/com.ibm.ws.webservices.thinclient_8.0.0.jar"/>
-->
<!-- end was specific files -->
</path>
<property name="scatest.tasks.class.path" refid="scatest.tasks.class.path"/>
<echo message="Running scatest using oracle.home = ${oracle.home} "></echo>
<taskdef name="scatest"
classname="oracle.integration.platform.testfwk.ant.ScaTestTask">
<classpath>
<pathelement path="${scatest.tasks.class.path}"/>
</classpath>
</taskdef>
<target name="test" description="Run a composite test">
<echo message="Classpth = ${scatest.tasks.class.path}"/>
<echo message="Running scatest using oracle.home = ${oracle.home} ${scatest.input}"></echo>
<echo message="Using context = build.properties"></echo>
<echo message="Using path = ${scatest.tasks.class.path}"></echo>
<input message="Please enter composite name to test:"
addproperty="scatest.input"/>
<input message="Please enter the path to the jndi properties:"
addproperty="jndi.properties.input"/>
<scatest compositedn="${scatest.partition}/${scatest.input}" timeout="${scatest.timeout}"
xsl="${scatest.format}" runname="antRun-TestFwk"
resultsdir="${scatest.result}"
context="${jndi.properties.input}">
<!-- provide , separated list of suite names, defaults to all suites
<suite name="${scatestsuite.input}"/>
-->
</scatest>
</target>
<target name="report" description="Generate junit report for a composite test" >
<echo message="Generate report to ${scatest.result}"/>
<junitreport todir="${scatest.result}/xml">
<fileset dir="${scatest.result}">
<include name="BPEL-*.xml" />
</fileset>
<report format="frames" todir="${scatest.result}/html" />
</junitreport>
</target>
</project>
What am I doing wrong here?
Edit: I have changed the command to 'test' instead of and-sca-test.xml and it worked
test -Dscatest.input=TestSOAAdd -Djndi.properties.input=D:/12c_Ant/ant_soa/jndi.properties
I am facing issue with invoking the junit to generate a report.
Whatever input I give for "Test report XMLs" it fails with no matches error.
I tried running infinispan in two machines and persisted the index data in one machine. When i try to run simultaneously in 2 machines with indexing and persisting(cache-store) into the database, i am getting the following exception,
Caused by: java.io.FileNotFoundException: Error loading metadata for index file: segments_2j|M|Course
at org.infinispan.lucene.impl.DirectoryImplementor.openInput(DirectoryImplementor.java:134)
at org.infinispan.lucene.impl.DirectoryLuceneV4.openInput(DirectoryLuceneV4.java:101)
at org.apache.lucene.store.Directory.openChecksumInput(Directory.java:113)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:341)
at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:57)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:923)
at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:53)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:67)
at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.readerFactory(SharingBufferReaderProvider.java:131)
at org.hibernate.search.indexes.impl.SharingBufferReaderProvider$PerDirectoryLatestReader.<init>(SharingBufferReaderProvider.java:206)
at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.createReader(SharingBufferReaderProvider.java:108)
... 24 more
My infinispan config file is:
infinispan-config.xml
<?xml version="1.0" encoding="UTF-8"?> <infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:7.2 http://www.infinispan.org/schemas/infinispan-config-7.2.xsd
urn:infinispan:config:store:jdbc:7.2 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-7.2.xsd"
xmlns="urn:infinispan:config:7.2"
xmlns:jdbc="urn:infinispan:config:store:jdbc:7.2">
<!-- *************************** -->
<!-- System-wide global settings -->
<!-- *************************** -->
<jgroups>
<!-- Note that the JGroups transport uses sensible defaults if no configuration
property is defined. See the JGroupsTransport javadocs for more flags.
jgroups-udp.xml is the default stack bundled in the Infinispan core jar: integration
and tuning are tested by Infinispan. -->
<stack-file name="default-jgroups-tcp" path="my-jgroupstcp.xml"/>
</jgroups>
<cache-container name="HibernateSearch" default-cache="default" statistics="false" shutdown-hook="DONT_REGISTER">
<transport stack="default-jgroups-tcp"/>
<!-- Duplicate domains are allowed so that multiple deployments with default configuration
of Hibernate Search applications work - if possible it would be better to use JNDI to share
the CacheManager across applications -->
<jmx duplicate-domains="true"/>
<!-- *************************************** -->
<!-- Cache to store Lucene's file metadata -->
<!-- *************************************** -->
<replicated-cache name="LuceneIndexesMetadata" mode="ASYNC" async-marshalling="true">
<locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
<transaction mode="NONE" />
<eviction max-entries="-1" strategy="NONE"/>
<expiration max-idle="-1"/>
<persistence passivation="false">
<jdbc:string-keyed-jdbc-store preload="true" fetch-state="true" read-only="false" purge="false">
<write-behind />
<property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>
<jdbc:connection-pool connection-url="jdbc:mysql://localhost:3306/hsearch"
driver="com.mysql.jdbc.Driver" username="my-username"
password="my-password"></jdbc:connection-pool>
<jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">
<jdbc:id-column name="ID" type="VARCHAR(255)"/>
<jdbc:data-column name="DATA" type="MEDIUMBLOB"/>
<jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>
</jdbc:string-keyed-table>
</jdbc:string-keyed-jdbc-store>
</persistence>
<indexing index="ALL"/>
<state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
</replicated-cache>
<!-- **************************** -->
<!-- Cache to store Lucene data -->
<!-- **************************** -->
<distributed-cache name="LuceneIndexesData" mode="ASYNC" async-marshalling="true">
<locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
<transaction mode="NONE"/>
<eviction max-entries="-1" strategy="NONE"/>
<expiration max-idle="-1"/>
<persistence passivation="false">
<jdbc:string-keyed-jdbc-store preload="true" fetch-state="true" read-only="false" purge="false">
<write-behind />
<property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>
<jdbc:connection-pool connection-url="jdbc:mysql://localhost:3306/hsearch"
driver="com.mysql.jdbc.Driver" username="my-username"
password="my-password"></jdbc:connection-pool>
<jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">
<jdbc:id-column name="ID" type="VARCHAR(255)"/>
<jdbc:data-column name="DATA" type="MEDIUMBLOB"/>
<jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>
</jdbc:string-keyed-table>
</jdbc:string-keyed-jdbc-store>
</persistence>
<indexing index="NONE"/>
<state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
</distributed-cache>
<!-- ***************************** -->
<!-- Cache to store Lucene locks -->
<!-- ***************************** -->
<replicated-cache name="LuceneIndexesLocking" mode="ASYNC" async-marshalling="true">
<locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
<transaction mode="NONE"/>
<eviction max-entries="-1" strategy="NONE"/>
<expiration max-idle="-1"/>
<indexing index="NONE"/>
<state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
</replicated-cache>
</cache-container>
</infinispan>
My jgroup configuration file is,
my-jgroup.xml
<config xmlns="urn:org:jgroups"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.6.xsd">
<TCP bind_addr="${jgroups.tcp.address:192.168.1.48}"
bind_port="${jgroups.tcp.port:7800}"
enable_diagnostics="false"
thread_naming_pattern="pl"
send_buf_size="640k"
sock_conn_timeout="300"
thread_pool.min_threads="${jgroups.thread_pool.min_threads:2}"
thread_pool.max_threads="${jgroups.thread_pool.max_threads:30}"
thread_pool.keep_alive_time="60000"
thread_pool.queue_enabled="false"
internal_thread_pool.min_threads="${jgroups.internal_thread_pool.min_threads:5}"
internal_thread_pool.max_threads="${jgroups.internal_thread_pool.max_threads:20}"
internal_thread_pool.keep_alive_time="60000"
internal_thread_pool.queue_enabled="true"
internal_thread_pool.queue_max_size="500"
oob_thread_pool.min_threads="${jgroups.oob_thread_pool.min_threads:20}"
oob_thread_pool.max_threads="${jgroups.oob_thread_pool.max_threads:200}"
oob_thread_pool.keep_alive_time="60000"
oob_thread_pool.queue_enabled="false"
/>
<MPING bind_addr="${jgroups.tcp.address:192.168.1.48}"
mcast_addr="${jgroups.mping.mcast_addr:228.2.4.6}"
mcast_port="${jgroups.mping.mcast_port:43366}"
ip_ttl="${jgroups.udp.ip_ttl:2}"
/>
<MERGE3 min_interval="10000"
max_interval="30000"
/>
<FD_SOCK />
<FD_ALL timeout="60000"
interval="15000"
timeout_check_interval="5000"
/>
<VERIFY_SUSPECT timeout="5000" />
<pbcast.NAKACK2 use_mcast_xmit="false"
xmit_interval="1000"
xmit_table_num_rows="50"
xmit_table_msgs_per_row="1024"
xmit_table_max_compaction_time="30000"
max_msg_batch_size="100"
resend_last_seqno="true"
/>
<UNICAST3 xmit_interval="500"
xmit_table_num_rows="50"
xmit_table_msgs_per_row="1024"
xmit_table_max_compaction_time="30000"
max_msg_batch_size="100"
conn_expiry_timeout="0"
/>
<pbcast.STABLE stability_delay="500"
desired_avg_gossip="5000"
max_bytes="1M"
/>
<pbcast.GMS print_local_addr="false"
join_timeout="15000"
/>
<MFC max_credits="2m"
min_threshold="0.40"
/>
<FRAG2 />
My persistence.xml is,
<?xml version="1.0" encoding="UTF-8" ?>
<persistence-unit name="IC" transaction-type="RESOURCE_LOCAL">
<class>com.csgsol.model.Course</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://192.168.1.99:3306/sampleDb"/>
<property name="javax.persistence.jdbc.user" value="my-username"/>
<property name="javax.persistence.jdbc.password" value="my-password"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.search.default.directory_provider" value="infinispan"/>
<property name="hibernate.search.default.indexmanager" value="org.infinispan.query.indexmanager.InfinispanIndexManager"/>
<property name="hibernate.search.default.indexmanager" value="near-real-time"/>
<property name="hibernate.search.default.exclusive_index_use" value="false"/>
<property name="hibernate.search.default.worker.execution" value = "async"/>
<property name="hibernate.search.lucene_version" value="LUCENE_4_10_4"/>
<property name="hibernate.search.infinispan.configuration_resourcename" value="infinispan-config.xml"/>
</properties>
</persistence-unit>
</persistence>
The versions i am using are
Infinispan - 7.2.0.Final
Lucene - 4.10.4
You should not use mode="ASYNC" for index caches. Since Infinispan 8.2.x (https://issues.jboss.org/browse/ISPN-4065) this configuration is forbidden
I'm working with ant for the first time, read lots of tutorials and examples, and still cant make this works. Every target works, but with test im getting
"Test TestMaze failed (crashed)."
I've tried to change lot of things (using lot of examples), still nothing. Can anyone tell me where is the problem please? Thanks a lot.
<?xml version="1.0"?>
<project name="Maze" default="default" basedir=".">
<property name="src.dir" location="src" />
<property name="build.dir" location="build" />
<property name="dist.dir" location="dest-server" />
<property name="test.dir" location="test" />
<property name="test.report.dir" location="testreport" />
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${test.report.dir}" />
</target>
<path id="junit.class.path">
<pathelement location="lib/junit-4.10.jar" />
<pathelement location="${build.dir}" />
</path>
<target name="compile" depends="clean">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
<javac srcdir="${src.dir}" destdir="${build.dir}" />
<javac srcdir="${test.dir}" destdir="${build.dir}">
<classpath refid="junit.class.path" />
</javac>
<jar destfile="${dist.dir}\Maze.jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="maze.tape.Commands" />
</manifest>
</jar>
</target>
<target name="test" depends="compile">
<junit printsummary="on" fork="true" haltonfailure="yes">
<classpath refid="junit.class.path" />
<formatter type="xml" />
<batchtest todir="${test.report.dir}">
<fileset dir="${test.dir}">
<include name="**/*Test*.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="run" depends="compile">
<java jar="dest-server/Maze.jar" fork="true"/>
</target>
</project>
Your test target is generating an xml file because you are using:
<formatter type="xml" />
when the attribute usefile is not used, the default value will be set and in this case, the value is "true".
You can set the attribute to false and the output will be displayed in the console.
We are having a problem when running unit tests using CPsuite and JMockit.
The tests run fine when executed in Eclipse, but if we use our Ant script to run all the tests (see script at the end of this question), we get the following exception:
Testcase: initializationError took 0 sec
Caused an ERROR
(class: mockit/internal/startup/JDK6AgentLoader, method: getVirtualMachineImplementationFromEmbeddedOnes signature: ()Lcom/sun/tools/attach/VirtualMachine;) Wrong return type in function
java.lang.VerifyError: (class: mockit/internal/startup/JDK6AgentLoader, method: getVirtualMachineImplementationFromEmbeddedOnes signature: ()Lcom/sun/tools/attach/VirtualMachine;) Wrong return type in function
at mockit.internal.startup.AgentInitialization.initializeAccordingToJDKVersion(AgentInitialization.java:21)
at mockit.internal.startup.Startup.verifyInitialization(Startup.java:86)
at mockit.Invocations.<clinit>(Invocations.java:22)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
This only happens on Ant, and only if there is a class that uses JMockit in the CPSuite set.
Anyone know why are we getting this error?
The Ant Script:
<project name="chughtai.junit" default="run" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<!-- https://junit-anttask.dev.java.net/ -->
<!--
<taskdef name="junit2" classname="com.sun.ant.junit.JUnitTask">
<classpath>
<pathelement path="lib/junit-anttask.jar" />
<pathelement path="lib/junit-4.4.jar" />
</classpath>
</taskdef>
-->
<property environment="env"/>
<property file="junit.build.properties"/>
<filelist id="third-party_jars" dir="lib">
<file name="${ext.classpath}/bin/lib/j2ee.jar"/>
</filelist>
<path id="project.path">
<pathelement path="${env.JAVA_HOME}/lib/tools.jar"/>
<pathelement location="classes/"/>
<fileset dir="lib">
<include name="**/*.jar"/>
<include name="**/*.properties"/>
</fileset>
<dirset dir="${build.dir}">
<include name="apps/**/classes"/>
<exclude name="apps/**/*Test*"/>
</dirset>
<pathelement location="${basedir}/junittestcases"/>
<filelist refid="third-party_jars"/>
<pathelement path="${ext.classpath}"/>
<pathelement location="${ext.classpath}/WEB-INF/classes"/>
</path>
<target name="init">
<mkdir dir="${prd.junit.test.report.dir}" />
<mkdir dir="${prd.junit.test.report.dir}/html" />
</target>
<!-- default target -->
<target name="run" depends="init">
<property name="myclasspath" refid="project.path"/>
<property name="java.class.path" refid="project.path"/>
<echo message="***Junit Controller Application***"/>
<echo message="basedir is ${basedir}"/>
<!--<echo message="${myclasspath}" />-->
<junit dir="${basedir}/junittestcases/" printsummary="yes" haltonfailure="no" fork="no" forkmode="once" reloading="false" maxmemory="1024m">
<jvmarg value="-Xms768M"/>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-XX:MaxPermSize=256M"/>
<sysproperty key="tests" value="${tests}"/>
<sysproperty key="java.class.path" value="${myclasspath}"/>
<formatter type="plain" usefile="true" extension=".txt" />
<formatter type="xml" />
<classpath refid="project.path"/>
<test name="${use.testcase}" haltonfailure="no" fork="false" todir="${prd.junit.test.report.dir}" if="use.testcase">
<formatter type="xml" />
</test>
</junit>
<!-- Generate the Unit Test reports -->
<junitreport todir="${prd.junit.test.report.dir}">
<fileset dir="${prd.junit.test.report.dir}">
<include name="*.xml" />
</fileset>
<report todir="${prd.junit.test.report.dir}/html" styledir="${xsl.templates}" format="frames">
<param name="build.number" expression="${app.build}" />
<param name="application.name" expression="${app.name}" />
</report>
</junitreport>
</target>
<target name="emma.report" depends ="" description="Creates 3 EMMA report formats based on the coverage data gathered.">
<if>
<available file="coverage.ec" />
<then>
<move file="coverage.ec" tofile="${coverage.dir}/junits.ec" overwrite="true"/>
</then>
</if>
<emma>
<report sourcepath="src" sort="+block,+name,+method,+class" metrics="method:70,block:80,line:80,class:100">
<!-- collect all EMMA data dumps (metadata and runtime)
[this can be done via nested <fileset> fileset elements
or <file> elements pointing to a single file]:
-->
<fileset dir="${coverage.dir}">
<include name="*.em" />
<include name="*.ec" />
</fileset>
<!-- for every type of report desired, configure a nested
element; various report parameters
can be inherited from the parent <report>
and individually overridden for each report type:
-->
<txt outfile="${coverage.dir}/coverage.txt" depth="package" columns="class,method,block,line,name" />
<xml outfile="${coverage.dir}/coverage.xml" depth="package" />
<html outfile="${coverage.dir}/coverage.html" depth="method" columns="name,class,method,block,line" />
</report>
</emma>
</target>
<target name="clean">
<delete file="${coverage.dir}/coverage.*" />
</target>
</project>