On Wed, 19 May 2010 11:14:15 -0400, Geoff <geoff.sal...@gmail.com> wrote:
This is cool. What I'd really like to do though is run some of the
clojure code belonging to the project during the build. I'm toying
with a webapp that runs on google appengine and I'd like to "bake"
some pages to produce static html/css/js files at build time using the
same templates and everything that the dynamic parts of the webapp
will use once it's deployed.
Geoff, Glad to hear you have got gae working smoothly for you.
It looks like your clojure-maven-plugin is using the classloader of
the plugin class when running the clojure. Could it also add the
clojure source directories in there some how? Maybe using a new
URLClassLoader with the plugin classloader as the parent. This might
only work if it's running after the compile phase. Not sure of the
maven classloader intricacies here.
I realised this shortly after posting. As you say, it requires a
classloader with the relavent classpath elements. When the plugin
extractor runs, the dependencies have not been resolved, so to get these
elements, code is required to resolve the project. I have some clojure
code elsewhere that resolves a project, but I am not sure if it is doing
it the "proper" way. Once resolved it should be simple to set up the
classloader. If you're interested I could send you the clojure code.
On May 16, 11:26 am, Jason Smith <ja...@lilypepper.com> wrote:
On May 16, 7:22 am, "Hugo Duncan" <hugodun...@users.sourceforge.net>
wrote:
>> ...
> In case you are interested, I recently implemented some of the >
infrastructure to allow you to writemavenplugins in clojure. A simple
> example that just logs basedir is here:
>http://github.com/hugoduncan/clojure-mojo-example/blob/master/src/mai...
> The annotation support isn't complete yet, but the simple example
works.
> --
> Hugo Duncan
On a related note, I was wondering if anyone had taken a stab at
Clojure stub generation. That is, on the "generate-sources" phase,
you generate .java files that stub out the classes you mean to create
in Clojure. Javac comes along, sees the stubs, and can compile all
the classes together.
Then, once Javac has done its work, you run Clojure to replace the
stubbed .class files with the real thing. Solves the "chicken-and-
egg" problem quite nicely.
The stubs would contain Javadoc, annotations, and generics
(eventually...), allowing Java frameworks to easily consume classes
compiled from Clojure. That is, it would work with the compile-time
annotation processor from Java 5 and 6, and it would also work
withMavenplugins, since they use Javadoc (inMaven2, at least) for
annotations. I had imagined thatMavenplugins would just sort of
fall out from having a good stub generator.
Has anyone talked about doing something like this???
This is how the Groovy cross-compiler works, and how GMaven (the
GroovyMavenplugin) performs cross compilation. Of course, it should
be much easier to do with Clojure. With Groovy you have to worry
about all the intricacies of ANTLR, but parsing in Clojure is dead
simple. Theoretically you should just have to look for the correct
function names and metadata and spit out Java source.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with
your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group
athttp://groups.google.com/group/clojure?hl=en
--
Hugo Duncan
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en