Problems with Arquillian Setup in an existing Ant-Project
ugiwolf Jun 25, 2012 4:30 AMHi!
I'm new in this community and I have some problems with integration of arquillian in my existing project. First of all, I will give you a short summary of my used components. The frontend is Flex (4.6), the backend is implemented with Java (EJB 3). For communication between front- and backend, I use GraniteDS. For communication with my Postgresql-Database I use JPA 2.0 (Provider: eclipselink). The .WAR is deployed on a Glassfish v3 Application Server. For deployment, I use Ant and for unit testing JUnit 3. For testing the EJB components I use OpenEJB. The problem here is, that OpenEJB only supports JPA 1.0 and this is the reason, why I tried changing to Arquillian.
A preferred configuration would be the use of Ant with Ivy. OpenEJB should be replaced by Arquillian and the unit testing framework should be JUnit 4.
I reconfigured my project with settings from http://www.dimitrijwulf.de/2012/04/how-to-setup-arquillian-without-maven-to-test-ejbs-on-jboss-7-1/#comment-20
but I got some problems:
Erstellungsdatei: /Users/juergenwolfsgruber/Documents/workspace/employeemanager/build.xml
[taskdef] Could not load definitions from resource flexTasks.tasks. It could not be found.
clean:
ERSTELLUNG FEHLGESCHLAGEN
/Users/juergenwolfsgruber/Documents/workspace/employeemanager/build.xml:79: Directory does not exist: /Users/juergenwolfsgruber/Documents/workspace/employeemanager/build
Gesamtzeit:280 Millisekunden
Here are some config-Files from my project:
ivy.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="" module="employeemanager" />
<dependencies>
<dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container" rev="1.0.0.CR7"/>
<dependency org="org.jboss.arquillian.container" name="arquillian-glassfish-embedded-3.1" rev="1.0.0.CR3"/>
<dependency org="org.glassfish.main.extras" name="glassfish-embedded-all" rev="3.1.2"/>
</dependencies>
</ivy-module>
ivysettings.xml:
<?xml version="1.0"?>
<ivysettings>
<settings defaultResolver="default"/>
<resolvers>
<chain name="default">
<ibiblio name="maven2" m2compatible="true"/>
<ibiblio name="jboss-public" m2compatible="true" checksums=""root="http://repository.jboss.org/nexus/content/groups/public"/>
<ibiblio name="maven2-repository.dev.java.net" m2compatible="true"root="http://download.java.net/maven/glassfish/"/>
</chain>
</resolvers>
</ivysettings>
and build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="employeemanager" default="deploy" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- Modify FLEX_HOME/JBOSS_HOME properties to reflect your environment -->
<property name="FLEX_HOME" value="/Applications/Adobe Flash Builder 4 Plug-in/sdks/4.1.0"/>
<property name="GLASSFISH_HOME"value="/Users/juergenwolfsgruber/glassfish3/glassfish/domains/domain1/autodeploy"/>
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="${user.home}/build.properties"/>
<property file="build.properties"/>
<property name="project.build.finalName" value="employeemanager-SNAPSHOT"/>
<property name="project.build.directory" value="target"/>
<property name="project.build.outputDirectory" value="${project.build.directory}/classes"/>
<property name="project.source.directory" value="java"/>
<property name="project.resource.directory" value="resources"/>
<property name="project.build.testOutputDirectory" value="${project.build.directory}/test-classes"/>
<property name="project.testSource.directory" value="ejbTest"/>
<property name="project.testResource.directory" value="resources"/>
<property name="project.test.reportsOutputDirectory" value="${project.build.directory}/test-results"/>
<property name="project.test.useFile" value="true"/>
<property name="maven.repo.central" value="http://repo1.maven.org/maven2"/>
<property name="maven.repo.jboss-public" value="https://repository.jboss.org/nexus/content/groups/public"/>
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
<property name="maven.settings.offline" value="false"/>
<property name="maven.settings.interactiveMode" value="true"/>
<property name="ivy.install.version" value="2.2.0-rc1"/>
<property name="ivy.jar.dir" value="${basedir}/.ivy"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<!-- Declare Flex Ant tasks (such as mxmlc used below) -->
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<!-- ====================================================================== -->
<!-- Ivy bootstrap targets -->
<!-- ====================================================================== -->
<target name="init-ivy">
<available property="ivy.installed" value="true" file="${ivy.jar.file}" type="file"/>
</target>
<target name="download-ivy" depends="init-ivy" unless="ivy.installed">
<mkdir dir="${ivy.jar.dir}"/>
<echo message="Installing ivy..."/>
<get src="${maven.repo.central}/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}"/>
</target>
<target name="load-ivy" depends="init-ivy,download-ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"classpathref="ivy.lib.path"/>
<ivy:settings file="${basedir}/ivysettings.xml"/>
</target>
<target name="clean-ivy" depends="load-ivy">
<ivy:cleancache/>
</target>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<target name="init" depends="load-ivy">
</target>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${project.build.directory}"/>
<delete includeemptydirs="true">
<fileset dir="build" defaultexcludes="false">
<include name="*"/>
</fileset>
</delete>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" depends="init" description="Compile the code">
<ivy:resolve conf="compile-only"/>
<ivy:cachepath pathid="build.classpath" conf="compile-only"/>
<mkdir dir="${project.build.outputDirectory}"/>
<javac destdir="${project.build.outputDirectory}"
nowarn="true"
debug="true"
optimize="true"
deprecation="false"
target="1.6"
verbose="false"
fork="true"
source="1.6">
<src>
<pathelement location="${project.source.directory}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Test compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="maven.test.skip">
<ivy:resolve conf="test"/>
<ivy:cachepath pathid="build.test.classpath" conf="test"/>
<mkdir dir="${project.build.testOutputDirectory}"/>
<javac destdir="${project.build.testOutputDirectory}"
nowarn="true"
debug="true"
optimize="true"
deprecation="false"
target="1.6"
verbose="false"
fork="true"
source="1.6">
<src>
<pathelement location="${project.testSource.directory}"/>
</src>
<classpath>
<path refid="build.classpath"/>
<path refid="build.test.classpath"/>
<pathelement location="${project.build.outputDirectory}"/>
</classpath>
</javac>
<copy todir="${project.build.testOutputDirectory}">
<fileset dir="${project.testResource.directory}"/>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Test targets -->
<!-- ====================================================================== -->
<target name="test"
depends="test-weld-embedded"
description="Run the test cases (default)"/>
<target name="test-weld-embedded"
depends="compile-tests"
description="Run the test cases on Weld Embedded">
<mkdir dir="${project.test.reportsOutputDirectory}"/>
<ivy:resolve conf="test-weld-embedded"/>
<ivy:cachepath pathid="build.test.classpath.weld-embedded" conf="test-weld-embedded"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="${project.test.useFile}"/>
<classpath>
<path refid="build.test.classpath.weld-embedded"/>
<pathelement location="${project.build.outputDirectory}"/>
<pathelement location="${project.build.testOutputDirectory}"/>
</classpath>
<batchtest todir="${project.test.reportsOutputDirectory}" unless="test">
<fileset dir="${project.testSource.directory}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${project.test.reportsOutputDirectory}" if="test">
<fileset dir="${project.testSource.directory}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-jbossas6-remote"
depends="compile-tests"
description="Run the test cases on a remote JBoss AS 6 instance">
<mkdir dir="${project.test.reportsOutputDirectory}"/>
<ivy:resolve conf="test-jbossas6-remote"/>
<ivy:cachepath pathid="build.test.classpath.jbossas6-remote" conf="test-jbossas6-remote"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="${project.test.useFile}"/>
<classpath>
<path refid="build.test.classpath.jbossas6-remote"/>
<pathelement location="${project.build.outputDirectory}"/>
<pathelement location="${project.build.testOutputDirectory}"/>
</classpath>
<batchtest todir="${project.test.reportsOutputDirectory}" unless="test">
<fileset dir="${project.testSource.directory}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${project.test.reportsOutputDirectory}" if="test">
<fileset dir="${project.testSource.directory}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-jbossas7-managed"
depends="compile-tests"
description="Run the test cases on a managed JBoss AS 7 instance">
<mkdir dir="${project.test.reportsOutputDirectory}"/>
<ivy:resolve conf="test-jbossas7-managed"/>
<ivy:cachepath pathid="build.test.classpath.jbossas7-managed" conf="test-jbossas7-managed"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="${project.test.useFile}"/>
<classpath>
<path refid="build.test.classpath.jbossas7-managed"/>
<pathelement location="${project.build.outputDirectory}"/>
<pathelement location="${project.build.testOutputDirectory}"/>
</classpath>
<batchtest todir="${project.test.reportsOutputDirectory}" unless="test">
<fileset dir="${project.testSource.directory}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${project.test.reportsOutputDirectory}" if="test">
<fileset dir="${project.testSource.directory}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-jbossas7-remote"
depends="compile-tests"
description="Run the test cases on a remote JBoss AS 7 instance">
<mkdir dir="${project.test.reportsOutputDirectory}"/>
<ivy:resolve conf="test-jbossas7-remote"/>
<ivy:cachepath pathid="build.test.classpath.jbossas7-remote" conf="test-jbossas7-remote"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="${project.test.useFile}"/>
<classpath>
<path refid="build.test.classpath.jbossas7-remote"/>
<pathelement location="${project.build.outputDirectory}"/>
<pathelement location="${project.build.testOutputDirectory}"/>
</classpath>
<batchtest todir="${project.test.reportsOutputDirectory}" unless="test">
<fileset dir="${project.testSource.directory}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${project.test.reportsOutputDirectory}" if="test">
<fileset dir="${project.testSource.directory}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-glassfish-embedded"
depends="compile-tests"
description="Run the test cases on Embedded GlassFish">
<mkdir dir="${project.test.reportsOutputDirectory}"/>
<ivy:resolve conf="test-glassfish-embedded"/>
<ivy:cachepath pathid="build.test.classpath.glassfish-embedded" conf="test-glassfish-embedded"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" forkmode="perBatch" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="${project.test.useFile}"/>
<classpath>
<path refid="build.test.classpath.glassfish-embedded"/>
<pathelement location="${project.build.outputDirectory}"/>
<pathelement location="${project.build.testOutputDirectory}"/>
</classpath>
<batchtest todir="${project.test.reportsOutputDirectory}" unless="test">
<fileset dir="${project.testSource.directory}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${project.test.reportsOutputDirectory}" if="test">
<fileset dir="${project.testSource.directory}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<jar jarfile="${project.build.directory}/${project.build.finalName}.jar"
compress="true"
index="false"
basedir="${project.build.outputDirectory}"
excludes="**/package.html"/>
</target>
<!-- ====================================================================== -->
<!-- A convenience target for the artifact type created by this project -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
<!-- ====================================================================== -->
<!-- Dependency reports -->
<!-- ====================================================================== -->
<target name="dependency-report" depends="init">
<ivy:resolve conf="test-weld-embedded"/>
<ivy:report todir="${project.build.directory}/dependency-reports/test-weld-embedded" conf="test-weld-embedded"/>
<ivy:resolve conf="test-jbossas6-remote"/>
<ivy:report todir="${project.build.directory}/dependency-reports/test-jbossas6-remote" conf="test-jbossas6-remote"/>
<ivy:resolve conf="test-jbossas7-managed"/>
<ivy:report todir="${project.build.directory}/dependency-reports/test-jbossas7-managed" conf="test-jbossas7-managed"/>
<ivy:resolve conf="test-jbossas7-remote"/>
<ivy:report todir="${project.build.directory}/dependency-reports/test-jbossas7-remote" conf="test-jbossas7-remote"/>
<ivy:resolve conf="test-glassfish-embedded"/>
<ivy:report todir="${project.build.directory}/dependency-reports/test-glassfish-embedded" conf="test-glassfish-embedded"/>
</target>
<!-- ====================================================================== -->
<!-- Help target -->
<!-- ====================================================================== -->
<target name="help">
<echo message="Please run: $ant -projecthelp"/>
</target>
<!-- Build an ear suitable for JBoss -->
<target name="ear" depends="clean">
<mkdir dir="build"/>
<jar destfile="build/employeemanager.jar">
<fileset dir="bin" includes="**/*.class" excludes="**/Test*.class"/>
<zipfileset file="resources/META-INF/graniteDS/persistence.xml" prefix="META-INF" />
<zipfileset file="resources/META-INF/graniteDS/services-config.properties" prefix="META-INF" />
<zipfileset file="resources/META-INF/graniteDS/log4j.properties"/>
</jar>
<war destfile="build/employeemanager.war" webxml="resources/META-INF/graniteDS/web.xml">
<zipfileset file="resources/META-INF/graniteDS/services-config.xml" prefix="WEB-INF/flex" />
<zipfileset file="resources/META-INF/graniteDS/granite-config.xml" prefix="WEB-INF/granite" />
<zipfileset file="resources/META-INF/graniteDS/persistence.xml" prefix="WEB-INF/classes/META-INF" />
<zipfileset file="resources/META-INF/graniteDS/services-config.properties" prefix="WEB-INF/classes/META-INF" />
<fileset dir="bin-debug" includes="Main.swf"/>
<fileset dir="bin-debug" includes="playerProductInstall.swf"/>
<fileset dir="bin-debug" includes="Main.html"/>
<fileset dir="bin-debug" includes="swfobject.js"/>
</war>
<ear destfile="build/employeemanager.ear" appxml="resources/META-INF/graniteDS/application.xml">
<fileset dir="build" includes="*.jar,*.war"/>
<zipfileset dir="lib/java" includes="granite.jar" prefix="lib" />
<zipfileset dir="lib/java" includes="granite-eclipselink.jar" prefix="lib" />
<zipfileset dir="lib/java" includes="eclipselink.jar" prefix="lib" />
</ear>
</target>
<!-- Deploy the ear in Glassfish -->
<target name="deploy" depends="ear">
<copy todir="${GLASSFISH_HOME}" file="build/employeemanager.ear"/>
</target>
</project>
It's clear for me, that the error message is not hard to understand. My problem is, that I don't know, whether my configurations are correct or if there are some other restrictions, knowing problems, ... with my used components in project.
I would be deeply grateful for constructive tipps.
Thanks,
Jürgen