Search code examples
jakarta-eeantjarejbear

Create an ant Ejb/Jar With all the data inside a folder


i've got a problem inside a Java-EE Application.

Due to some choice the system is the following one:

Java Class and Properties inside a Java Package. Java Package inside a Ejb Project. Ear of all the data.

For creating all of this we need to use ant, i cannot use other system and ant is run on a remote server after a Deliver.

This Example show what for now we've got:

<target name="init" description="mkdir">
<tstamp />
<delete dir="${path_tmp}"/>
 <mkdir dir="${class_dir}" />
 <mkdir dir="${ejb_destdir}" />
 <delete file="${ejb_destdir}/*"/>

<target name="compilaEjb_utility" description="ejb compile">
    <antcall target="init_jar" />
    <javac srcdir="${javaejbDir_utility}" 
            destdir="${class_dir}"
           includes="**/*.java **/*.properties" 
                 fork="yes"
         executable="${project_javahome}/bin/javac"
            compiler="${compiler}"  
           target="${target}" 
             verbose="${verbose}"
        deprecation="${deprecation}"
                debug="${debug_opt}" 
         debuglevel="${debug_level}"    
             source="1.6">
     <classpath refid="project.class.path"/>
    </javac>
    <copy todir="${class_dir}" overwrite="true">
        <fileset dir="${javaDir}" includes="**/*.properties" />
     </copy>     
</target>

<target name="create_jar" depends="compilaEjb_utility">
    <jar destfile="${ejb_destdir}/${ejbName_utility}.jar" basedir="${class_dir}" includes="**/*">
     <metainf dir="${metainf_dir_utility}"/>
    </jar>  
</target>

However those command create the Jar with all the .java (after compiling it) but the .properties file are not taken, what i'm doing wrong?


Solution

  • Solved. Normally, when you do use this code to make an Ejb you do not have file that aren't .Java, however it does work fine with a War.

    To solve it we changed this code:

    <copy todir="${class_dir}" overwrite="true">
        <fileset dir="${javaDir}" includes="**/*.properties" />
     </copy>
    

    With

    <copy todir="${class_dir}" overwrite="true">
        <fileset dir="${javaejbDir_utility}" includes="**/*.properties" />
     </copy>
    

    It was wrong the source of the copy command.