私はAntの初心者です(Mavenから来ました)、次の問題があります
GUI.jarという名前のプロジェクトと、プロジェクトを jar ファイルにビルドする Ant スクリプトがあります。
私のプロジェクトには、次のパッケージがあります。(Eclipseは、このパッケージに関連する白い色のアイコンを表示します)
問題は、Ant スクリプトが最終的なGUI.jarファイルをビルドするときに、このファイルの中にフォルダー/com/MyCompany/MySoftware/resources/が含まれず、コマンド ラインからGUI.jarファイルを実行するときに発生することです。次のエラー メッセージが表示されます。
java.io.IOException: No localization could be found in '/com/MyCompany/MySoftware/resources/Strings_it_IT.properties'
これは、私のbuild.xml Ant スクリプトのコードです。
<?xml version="1.0"?>
<project name="Peacock Engine" default="default">
<tstamp />
<condition property="unix">
<os family="unix" />
</condition>
<condition property="mac">
<os family="mac" />
</condition>
<!-- ============================================ -->
<!-- Load build properties -->
<!-- ============================================ -->
<property name="project.buildfile" value="build.num" />
<property file="${project.buildfile}" />
<property file="info.properties" />
<!-- ============================================ -->
<!-- Specify the classpath -->
<!-- ============================================ -->
<path id="project.classpath">
<fileset dir="../../SharedLib/">
<include name="**/*.jar" />
</fileset>
<fileset dir="../../CrystalIceAdapter/Atmos/AtmosAdapter/Release/">
<include name="atmosadapter.jar" />
</fileset>
<fileset dir="../../CrystalIceTasks/Release/">
<include name="dataspace.jar" />
</fileset>
<fileset dir="../../CrystalIceTasksLib/Release/">
<include name="taskslib.jar" />
</fileset>
<fileset dir="../../CrystalIceXMLHandler/Release/">
<include name="XMLHandler.jar" />
</fileset>
<fileset dir="../../ShellExtBridge/Release/">
<include name="shellExtBridge.jar" />
</fileset>
</path>
<!-- ============================================ -->
<!-- The default target -->
<!-- ============================================ -->
<target name="default" depends="jar" />
<!-- Elimina le cartelle contenenti le classi compilate ed i jar -->
<target name="clean">
<echo message="Into CrystalGUI build.xml clean target" />
<!-- <delete dir="../Release" /> -->
<delete file="../Release/*.jar"/>
<!-- Elimina directory del jar finale -->
<delete dir="bin" />
<!-- Elimina directory delle classi compilate -->
</target>
<!-- ============================================ -->
<!-- Set the path if the operating system is -->
<!-- U -->
<!-- ============================================ -->
<target name="initMacPath" if="mac" depends="clean">
<echo message="initMacPath: SETTING MAC PATH" />
<!--<property name="path">${basedir}/../../../Mac/CrystalIce/CrystalIce/CrystalIce/Build/Products/Debug/CrystalIce.app/Contents/Resources/java/</property>-->
<property name="path">${basedir}/../../../CrossPlatform/CrystalIceGUI/Project/data/CrystalIce.app/Contents/Resources/java/</property>
</target>
<target name="initUnixPath" if="unix" depends="clean">
<echo message="initUnixPath: SETTING UNIX PATH" />
<property name="path">/usr/share/XCloud/appl/lib/</property>
</target>
<!-- ============================================ -->
<!-- Compile the java sources to classes -->
<!-- ============================================ -->
<target name="compile" description="Compile the Java sources to class files" depends="init">
<echo message="Into CrystalGUI compile.xml jar target" />
<mkdir dir="bin" />
<javac srcdir="${basedir}/src" destdir="bin" classpathref="project.classpath" />
</target>
<!-- ============================================ -->
<!-- Copy the JAR dependency and the driver in -->
<!-- the right location -->
<!-- -->
<!-- UNIX and MAC version -->
<!-- ============================================ -->
<target name="init" depends="initMacPath , initUnixPath">
<echo message="Into CrystalGUI build.xml init target" />
<ant antfile="build.xml" dir="${basedir}/../../CrystalIceXMLHandler/Project/" />
<ant antfile="build.xml" dir="${basedir}/../../ShellExtBridge/Project/" />
<ant antfile="build.xml" dir="${basedir}/../../CrystalIceAdapter/Atmos/AtmosAdapter/Project/AtmosAdapter/" />
<ant antfile="build.xml" dir="${basedir}/../../CrystalIceTasksLib/Project/" />
<ant antfile="build.xml" dir="${basedir}/../../CrystalIceTasks/Project/" />
<!-- Copy SharedLib jar files: -->
<!--<copy todir="${basedir}/../../../../../../../../usr/share/XCloud/appl/lib">-->
<!--<copy todir="/usr/share/XCloud/appl/lib">-->
<echo message="Copy to: ${path}" />
<copy todir="${path}">
<fileset dir="${basedir}/../../SharedLib" />
</copy>
<!-- Copy EMC Esu Rest API: -->
<copy file="${basedir}/../../EsuAtmos/EsuApi 2.0.3.1/build/emcesu.jar" tofile="${path}emcesu.jar" />
<echo message="emcesu.jar copyed" />
<!--
<copy file="${basedir}/../../EsuAtmos/EsuApi 2.0.3.1/build/emcesu.jar" tofile="/usr/share/XCloud/appl/lib/emcesu.jar" />
-->
<!-- Copy atmosadapter files: -->
<copy file="${basedir}/../../CrystalIceAdapter/Atmos/AtmosAdapter/Release/atmosadapter.jar" tofile="${path}atmosadapter.jar" />
<!--
<copy file="${basedir}/../../CrystalIceAdapter/Atmos/AtmosAdapter/Release/atmosadapter.jar" tofile="/usr/share/XCloud/appl/lib/atmosadapter.jar" />
-->
<!-- Copy xmlhanlder files: -->
<copy file="${basedir}/../../CrystalIceXMLHandler/Release/XMLHandler.jar" tofile="${path}XMLHandler.jar" />
<!--
<copy file="${basedir}/../../CrystalIceXMLHandler/Release/XMLHandler.jar" tofile="/usr/share/XCloud/appl/lib/XMLHandler.jar" />
-->
<!-- Copy taskslib files: -->
<copy file="${basedir}/../../CrystalIceTasksLib/Release/taskslib.jar" tofile="${path}taskslib.jar" />
<!--
<copy file="${basedir}/../../CrystalIceTasksLib/Release/taskslib.jar" tofile="/usr/share/XCloud/appl/lib/taskslib.jar" />
-->
<!-- Copy dataspace files: -->
<copy file="${basedir}/../../CrystalIceTasks/Release/dataspace.jar" tofile="${path}dataspace.jar" />
<!--
<copy file="${basedir}/../../CrystalIceTasks/Release/dataspace.jar" tofile="/usr/share/XCloud/appl/lib/dataspace.jar" />
-->
<!-- Copy shellextbridge files: -->
<copy file="${basedir}/../../ShellExtBridge/Release/shellExtBridge.jar" tofile="${path}shellExtBridge.jar" />
<!--
<copy file="${basedir}/../../ShellExtBridge/Release/shellExtBridge.jar" tofile="/usr/share/XCloud/appl/lib/shellExtBridge.jar" />
-->
</target>
<!-- Rutigliano path MAC
/Users/xdrive/Documents/XDrive SVN/Implementazione/Mac/CrystalIce/CrystalIce/CrystalIce/Build/Products/Debug/CrystalIce.app/Contents/Resources/java/httpclient-cache-4.3.jar
-->
<!-- ============================================ -->
<!-- Pack the java classes in a jar file -->
<!-- ============================================ -->
<target name="jar" depends="compile">
<echo message="Into CrystalGUI build.xml jar target" />
<!-- Define the property jar.classpath
You may need to reference classes in other JAR files from within a JAR file.
For example, in a typical situation an application is bundled in a JAR file whose manifest
references a different JAR file (or several different JAR files) that serves as utilities
for the purposes of that application.
-->
<pathconvert property="jar.classpath" pathsep=" ">
<!-- classpath container: it contains a set of path element pointing to some jars or directories -->
<path refid="project.classpath" />
<chainedmapper>
<!-- A chainedmapper is applied to the project.classpath -->
<!-- STEP 1: Remove all directory information from the path element. Ex: dir1/dir2/lib1.jar is trasformed in lib1.jar -->
<flattenmapper />
<!-- STEP 2: Will prefix every path element resulting from step1 with lib/. EX: lib1.jar will became lib/lib1.jar -->
<globmapper from="*" to="lib/*" />
</chainedmapper>
</pathconvert>
<jar destfile="${basedir}/../Release/GUI.jar" index="false">
<fileset dir="${basedir}/bin" excludes="${project.pluginptrn}/** **/tests/**" />
<manifest>
<attribute name="Specification-Title" value="Java Utility Classes" />
<attribute name="Specification-Version" value="1.0.1-15" />
<attribute name="Specification-Vendor" value="TechUb" />
<attribute name="Created-By" value="${info.software.author}" />
<attribute name="Class-Path" value="${jar.classpath}" />
<attribute name="Main-Class" value="ConnectDataSpace" />
</manifest>
</jar>
<!--
<copy todir="${basedir}/../Release/lib">
<fileset dir="${basedir}/lib">
<include name="*" />
</fileset>
</copy>
<copy todir="${basedir}/../Release">
<fileset dir="${basedir}" includes="data/*/**" />
</copy>
<copy file="${basedir}/../Release/GUI.jar" tofile="/usr/share/XCloud/appl/GUI.jar" />
-->
<copy file="${basedir}/../Release/GUI.jar" tofile="${path}GUI.jar" />
</target>
</project>
この問題を解決し、パッケージcom.myCompany.mySoftware.resourcesのコンテンツを最終的な GUI.jar ファイルの/com/MyCompany/MySoftware/resources/フォルダー内に配置するにはどうすればよいですか?
TNX
アンドレア