ラベル Eclipse の投稿を表示しています。 すべての投稿を表示
ラベル Eclipse の投稿を表示しています。 すべての投稿を表示

10.13.2011

Specify a Directory to Include JAR files in Ant XML



I failed to specify JAR files which should be included when Ant execute javac. I took for granted that below description was correct to include all JAR files in a directory specified by "./jar".

Incorrect example
<property name="jar.dir" value="./jar" />
<target name="compile" description="compile all sources">
    <javac srcdir="${src.dir}" destdir="${bin.dir}" classpath="${jar.dir}" deprecation="on" />
</target>


It seems "classpath" element of "javac" tag should not point to paths of directories but paths of JAR files. One of correct description is below.

Correct example
<property name="jar.dir" value="./jar" />
<path id="jar.classpath">
    <fileset dir="${jar.dir}">
        <include name="*.jar" />
    </include></fileset>
</path>
<target name="compile" description="comile all sources">
    <javac classpathref="jar.classpath" deprecation="on" destdir="${bin.dir}" srcdir="${src.dir}" />
</target>

Ant の XML で javac の classpath を指定するときにハマったのでメモ. あるディレクトリ(./jar)内の JAR ファイルをまとめて指定しようとした際に以下のように書いたら import エラーが多発.

間違いの例
<property name="jar.dir" value="./jar" />
<target name="compile" description="compile all sources">
    <javac srcdir="${src.dir}" destdir="${bin.dir}" classpathref="${jar.dir}" deprecation="on" />
</target>


javac タグの classpath エレメントではディレクトリではなく JAR ファイルを直接指定しなければならないようだ. JAR ファイルをひとつひとつ指定する代わりに指定ディレクトリ下の JAR ファイルを全部読みたいときは, 以下のようにしないとまずかったらしい.

正しい例
<property name="jar.dir" value="./jar" />
<path id="jar.classpath">
    <fileset dir="${jar.dir}">
        <include name="*.jar" />
    </include></fileset>
</path>
<target name="compile" description="comile all sources">
    <javac classpathref="jar.classpath" deprecation="on" destdir="${bin.dir}" srcdir="${src.dir}" />
</target>

7.20.2011

Change SVN Eclipse-plugin from Subclipse to Subversive


I read some articles says "Subversive better than Subclipse." So, I changed SVN plugin from Subclipse to Subversive.

Uninstall Subclipse and install Sebversive in Eclipse Market Place.
Althogh existent checked out projects are not recognized as SVN projects, you do not have to checked them out again. Delete the projects from workspace (DO NOT DELETE FROM YOUR DISK!!) and import the projects again.

Eclipse の SVN プラグインにはこれまで Subclipse を使っていましたが,
Subversive の方が何となく評判良さそうなので乗り換えてみることに.

Eclipse Market Place にて Subclipse を uninstall し, Subversive を install.
このままだとチェックアウト済みプロジェクトが認識されませんが,
一旦 workspace からプロジェクトを削除し(ディスクから消さないように!),
再度インポートすると SVN のプロジェクトとして認識されます.
再度チェックアウトするのもアレなのでこれが楽かと.