Ant build for simple JFace project [message #246158] |
Thu, 27 May 2004 11:47 |
Eclipse User |
|
|
|
Originally posted by: john.rmts.donpac.ru
Hi,
How can I write build.xml for simple JFace project?
Source:
package jtest.ui;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.widgets.Display;
public class JTestApp extends ApplicationWindow {
public JTestApp() {
super(null);
}
public static void main(String[] args) {
JTestApp w = new JTestApp();
w.setBlockOnOpen(true);
w.open();
Display.getCurrent().dispose();
}
}
Project files tree:
JTest
bin
jtest
ui
JTestApp.class
src
jtest
ui
JTestApp.java
lib
win32
swt.jar
swt-win32-2135.dll
linux-gtk2
swt.jar
libswt-gtk-2135.so
libswt-pi-gtk-2135.so
linux-motif
swt.jar
libswt-motif-2135.so
boot.jar
jface.jar
runtime.jar
build.xml - ant build script
This project can be compiled by Eclipse IDE.
How can I write crossplatform build.xml (for win32/linux)?
I wrote the next build.xml (for win32 only):
<project name="JTestApp" default="compile" basedir=".">
<target name="init">
<property name="src" value="src" />
<property name="dst" value="bin" />
<property name="lib"
value=" lib/win32/swt.jar;lib/jface.jar;lib/runtime.jar;lib/boot.jar " />
</target>
<target name="clean" depends="init">
<delete dir="${dst}" />
</target>
<target name="prepare" depends="clean">
<mkdir dir="${dst}" />
</target>
<target name="compile" depends="prepare">
<javac classpath=".;$(lib)" srcdir="${src}" destdir="${dst}" />
</target>
</project>
But I can't use it due to following errors:
Buildfile: D:\eclipse\workspace\JTest\build.xml
init:
clean:
[delete] Deleting directory D:\eclipse\workspace\JTest\bin
prepare:
[mkdir] Created dir: D:\eclipse\workspace\JTest\bin
compile:
[javac] Compiling 1 source file to D:\eclipse\workspace\JTest\bin
[javac]
D:\eclipse\workspace\JTest\src\jtest\ui\JTestApp.java:17: package
org.eclipse.jface.window does not exist
[javac] import org.eclipse.jface.window.ApplicationWindow;
[javac] ^
[javac]
D:\eclipse\workspace\JTest\src\jtest\ui\JTestApp.java:18: package
org.eclipse.swt.widgets does not exist
[javac] import org.eclipse.swt.widgets.Display;
[javac] ^
[javac]
D:\eclipse\workspace\JTest\src\jtest\ui\JTestApp.java:24: cannot resolve
symbol
[javac] symbol : class ApplicationWindow
[javac] location: class jtest.ui.JTestApp
[javac] public class JTestApp extends ApplicationWindow {
[javac] ^
[javac]
D:\eclipse\workspace\JTest\src\jtest\ui\JTestApp.java:32: cannot resolve
symbol
[javac] symbol : method setBlockOnOpen (boolean)
[javac] location: class jtest.ui.JTestApp
[javac] w.setBlockOnOpen(true);
[javac] ^
[javac]
D:\eclipse\workspace\JTest\src\jtest\ui\JTestApp.java:33: cannot resolve
symbol
[javac] symbol : method open ()
[javac] location: class jtest.ui.JTestApp
[javac] w.open();
[javac] ^
[javac]
D:\eclipse\workspace\JTest\src\jtest\ui\JTestApp.java:34: cannot resolve
symbol
[javac] symbol : variable Display
[javac] location: class jtest.ui.JTestApp
[javac] Display.getCurrent().dispose();
[javac] ^
[javac] 6 errors
[javac] BUILD FAILED:
file:D:/eclipse/workspace/JTest/build.xml:19: Compile failed; see the
compiler error output for details.
Total time: 1 second
|
|
|
Re: Ant build for simple JFace project [message #246223 is a reply to message #246158] |
Thu, 27 May 2004 13:07 |
Eclipse User |
|
|
|
Originally posted by: john.rmts.donpac.ru
Next build.xml is working (in os command line):
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="JTest" default="compile" basedir=".">
<property name="project.dir" value="."/>
<property name="source.dir" value="${project.dir}/src"/>
<property name="build.dir" value="${project.dir}/bin"/>
<property name="lib.dir" value="${project.dir}/lib"/>
<property name="cross-platform.libs"
value=" ${lib.dir}/jface.jar;${lib.dir}/runtime.jar;${lib.dir}/boot. jar "/>
<condition property="platform-specific.libs"
value="${lib.dir}/win32/swt.jar">
<and>
<os family="windows"/>
</and>
</condition>
<condition property="platform-specific.libs"
value="${lib.dir}/linux-gtk2/swt.jar">
<and>
<os family="unix"/>
</and>
</condition>
<property name="class.path"
value="${cross-platform.libs};${platform-specific.libs}"/>
<target name="compile">
<javac srcdir="${source.dir}" destdir="${build.dir}"
classpath="${class.path}"/>
</target>
</project>
But Eclipse say: unexpected element "condition". What can I do?
|
|
|
|
Re: Ant build for simple JFace project [message #246685 is a reply to message #246352] |
Fri, 28 May 2004 04:17 |
Eclipse User |
|
|
|
Originally posted by: john.rmts.donpac.ru
Darin Swanson пишет:
> I am not seeing immediate problems with your buildfile on 3.0 M9
> Which version of Eclipse are you using (Help>About Eclipse platform>Build id
> in the newer builds)
Eclipse Platform
Version: 2.1.2
Build id: 200311030802
|
|
|
|
Powered by
FUDForum. Page generated in 0.03407 seconds