Working examples?

11 views
Skip to first unread message

Rich Hickey

unread,
Sep 11, 2008, 2:56:05 PM9/11/08
to gxp-users
Are there complete working examples utilizing the CLI and Ant tasks
anywhere? I can't get anything other than NPEs out of either one
(version 0.2.3)

Thanks,

Rich

harryh

unread,
Sep 11, 2008, 2:58:51 PM9/11/08
to gxp-users
http://code.google.com/p/gxp/wiki/GxpAndAnt has a brief introduction
to getting things working with Ant.

We know the ant task is pretty flaky right now, not providing
particularly good error messages (and NPEing) when it gets bad input.
I'll work on this at some point, but at the moment other things are
taking priority (we do welcome patches though!). If you post the
specific NPEs you are getting, I can help walk you through your
problems.

-harryh

Rich Hickey

unread,
Sep 11, 2008, 3:15:28 PM9/11/08
to gxp-...@googlegroups.com
Given the following build.xml:

<project name="gxptest">

<description>
Script to build GXP files
</description>

<taskdef name="gxpc" classname="com.google.gxp.compiler.ant.GxpcTask"
classpath="c:/dev/gxp/gxp-0.2.3-beta.jar" />

<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="classes" location="${build}/classes"/>
<property name="gen" location="${build}/gen"/>

<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${classes}"/>
<mkdir dir="${gen}"/>
</target>

<target name="compile" depends="init"
description="Compile Java sources.">
<gxpc srcdir="${src}"
srcpaths="${src}"
destdir="${gen}"
target="test.gxptest.messages" />
<copy todir="${classes}">
<fileset dir="${src}/">
<include name="test/gxptest/messages_en.properties" />
</fileset>
</copy>
<javac srcdir="${src}" destdir="${classes}" includeJavaRuntime="yes"
debug="true">
<src>
<pathelement location="${gen}/" />
</src>
</javac>
</target>

<target name="clean"
description="Remove autogenerated files and directories.">
<delete dir="${build}"/>
</target>

</project>

C:\Dev\gxptest>ant compile

Buildfile: build.xml

init:

compile:

BUILD FAILED
java.lang.NullPointerException
at
com
.google
.gxp
.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:
181)
at
com
.google
.gxp.com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:
141)
at
com.google.gxp.com.google.common.collect.ImmutableMap.access
$300(ImmutableMap.java:55)
at com.google.gxp.com.google.common.collect.ImmutableMap
$Builder.put(ImmutableMap.java:176)
at
com
.google
.gxp
.compiler.CompilationSet.createCompilationUnits(CompilationSet.java:143)
at
com.google.gxp.compiler.CompilationSet.<init>(CompilationSet.java:130)
at
com.google.gxp.compiler.CompilationSet.<init>(CompilationSet.java:53)

at com.google.gxp.compiler.CompilationSet
$Builder.build(CompilationSet.java:98)
at com.google.gxp.compiler.Compiler.call(Compiler.java:105)
at com.google.gxp.compiler.ant.GxpcTask.execute(GxpcTask.java:
99)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:
106)
at org.apache.tools.ant.Task.perform(Task.java:348)

src/HelloWorld.gxp is from the tutorial:

<!-- HelloWorld.gxp -->
<gxp:template name='com.google.tutorial.HelloWorld' xmlns:gxp='http://google.com/2001/gxp'
>
Hello, World!
</gxp:template>

Thanks,

Rich

harryh

unread,
Sep 11, 2008, 3:22:47 PM9/11/08
to gxp-...@googlegroups.com
What does your directory structure look like under src?

HelloWorld.gxp needs to live at src/com/google/tutorial/HelloWorld.gxp

If it doesn't, you can adjust the srcpaths in the <gxpc> task to point
to the part of the directory up to just before com.

So if HellowWorld.gxp was at src/gxp/com/google/tutorial/HelloWorld.gxp

then you could change srcpaths to ${src}/gxp

At least I think this is the problem. If it doesn't work let me know.
I'm also gonna look into this further. I'm kind of surprised that it
could NPE at this point in the code.

-harryh

Rich Hickey

unread,
Sep 11, 2008, 3:55:12 PM9/11/08
to gxp-...@googlegroups.com
The dir structure was it - thanks.

Rich

Reply all
Reply to author
Forward
0 new messages