I started work on a Maven Fantom plugin awhile back (pretty straightforward; it lets you add src/main/fan to a Maven project and - after adding a plugin to pom.xml - the Fantom sources are automatically compiled into .class files along with the rest of your Java sources), but put the project on the backburner because building even just Hello World took 30 seconds.
I'm planning to take it up again and open source it via github once I've had a chance to put it through its paces, but in the meantime I wanted to put out a request for some equivalent of JarDist that will just generate straight .class files instead of a jar.
The only reason the builds are taking 30+ seconds is that JarDist outputs a jar, which the Maven plugin then has to decompress and extract to get at the underlying .class files. If Fantom had some way to generate straight .class files, I imagine it would be pretty zippy.
Anyway, if anyone has any interest in a Maven Fantom plugin, feature requests, etc., I am all ears.
qualidafialSat 6 Nov 2010
I'm really looking forward to getting my hands on this!
My wishlist, in addition to what you've already described:
ability to publish fantom pod files as artifacts
ability to declare pod artifacts as dependencies in the pom, and have them pulled down automagically from the repository
and especially, publish core fantom files to maven central so that we can:
just declare the fantom plugin dependency in the pom, and have the entire core downloaded automatically
a deploy goal that builds a standard fantom repository and runtime.
rfeldmanSat 6 Nov 2010
At present I am generating a build.fan on the fly and running fan build.fan on it, so to publish fantom pods as artifacts would simply entail searching for a build.fan in the same directory as pom.xml and running that instead of generating one on the fly.
I think it'll be important to run whatever version of fan the user has installed so the user has control over which version they want to use to compile, but it certainly would be nice to publish the Fantom core to Maven so you could just declare a dependency on the plugin and be off to the races, without having to download and install Fantom separately.
After all, the whole reason I want a Maven Fantom plugin in the first place is that I can't justify scrapping the Maven-based project I'm working on and rebooting in Fantom, but it's a lot easier to justify adding src/main/fan and writing new code in Fantom.
Good suggestions, I'll see how many of them I can get done for version 1.
ivanSun 7 Nov 2010
We are very interested in maven plugin for Fantom, especially for using it with Tycho, since we use Fantom in Eclipse plugins a lot.
qualidafialMon 8 Nov 2010
Just out of curiosity, why would you need to generate a build.fan? It is only a class that extends BuildPod (typically) so couldn't you just construct that BuildPod object from within the fantom maven plugin, and invoke the build directly directly through that?
I'm not opposed to generating build.fan for old time's sake, similar to how mvn eclipse:eclipse generates your .project and .classpath files in Eclipse. But it feels very unmaven-ish to have maven depend on anything outside the pom for build configuration.
brianMon 8 Nov 2010
@rfeldman
JarDist is probably the most inefficient way to get raw classfiles. The quickest way is to use the Jstub program:
IMHO,Fantom can manage the dependency. Why do we need this?
rfeldmanSat 27 Nov 2010
If you already have an existing large Java maven project, this is a more feasible way to incorporate fantom than rewriting everything to be pod-based.
qualidafialSat 27 Nov 2010
Also, as long as your dependencies are published to Maven central repository, sharing a project with dependencies is brutally simple: just clone the Maven-based Fantom project, and all your dependencies are fetched for you. It's also very handy when you evolve your dependencies to just change a version number in the pom, and presto, everybody else gets the new version automatically.
cheeserSun 5 Dec 2010
I could really use this tonight. ;)
rajmahendraThu 30 Dec 2010
@brian
Why not fanx.tools.Jstu be a switch with the fan command ?
something like
fan -jstub podName (creates a podName.jar)
fan -jstubx podName (creates exploded jstub)
Also i like a good interoperability with java. (java uses fan and fan uses java)
(Let me introduce myself i am Raj from India and new to Fan & Tales.)
cheeserSun 6 Feb 2011
So no public repo for this yet? I can bootstrap my own plugin from some earlier stuff I've done but I'd rather collaborate if possible.
rfeldman Fri 5 Nov 2010
I started work on a Maven Fantom plugin awhile back (pretty straightforward; it lets you add src/main/fan to a Maven project and - after adding a plugin to pom.xml - the Fantom sources are automatically compiled into .class files along with the rest of your Java sources), but put the project on the backburner because building even just Hello World took 30 seconds.
I'm planning to take it up again and open source it via github once I've had a chance to put it through its paces, but in the meantime I wanted to put out a request for some equivalent of JarDist that will just generate straight .class files instead of a jar.
The only reason the builds are taking 30+ seconds is that JarDist outputs a jar, which the Maven plugin then has to decompress and extract to get at the underlying .class files. If Fantom had some way to generate straight .class files, I imagine it would be pretty zippy.
Anyway, if anyone has any interest in a Maven Fantom plugin, feature requests, etc., I am all ears.
qualidafial Sat 6 Nov 2010
I'm really looking forward to getting my hands on this!
My wishlist, in addition to what you've already described:
rfeldman Sat 6 Nov 2010
At present I am generating a build.fan on the fly and running fan build.fan on it, so to publish fantom pods as artifacts would simply entail searching for a build.fan in the same directory as pom.xml and running that instead of generating one on the fly.
I think it'll be important to run whatever version of fan the user has installed so the user has control over which version they want to use to compile, but it certainly would be nice to publish the Fantom core to Maven so you could just declare a dependency on the plugin and be off to the races, without having to download and install Fantom separately.
After all, the whole reason I want a Maven Fantom plugin in the first place is that I can't justify scrapping the Maven-based project I'm working on and rebooting in Fantom, but it's a lot easier to justify adding src/main/fan and writing new code in Fantom.
Good suggestions, I'll see how many of them I can get done for version 1.
ivan Sun 7 Nov 2010
We are very interested in maven plugin for Fantom, especially for using it with Tycho, since we use Fantom in Eclipse plugins a lot.
qualidafial Mon 8 Nov 2010
Just out of curiosity, why would you need to generate a build.fan? It is only a class that extends BuildPod (typically) so couldn't you just construct that BuildPod object from within the fantom maven plugin, and invoke the build directly directly through that?
I'm not opposed to generating build.fan for old time's sake, similar to how
mvn eclipse:eclipse
generates your .project and .classpath files in Eclipse. But it feels very unmaven-ish to have maven depend on anything outside the pom for build configuration.brian Mon 8 Nov 2010
@rfeldman
JarDist is probably the most inefficient way to get raw classfiles. The quickest way is to use the Jstub program:
That generates the classfiles packaged together as a zip file (jar). Although it should be very fast, I see ~1sec stub times for even large pods.
If you really need to get the classfiles outside of a zip, I can add a flag to that program fairly easily. Just let me know.
rfeldman Mon 8 Nov 2010
Getting them outside a zip would be really great - the slowness of JarDist is dwarfed by the slowness of unpacking the zip right now.
brian Mon 8 Nov 2010
No problem, added a "-nozip" flag to Jstub:
This will generate the classfiles straight to the file system such as
changeset
Let me know how that works out for you.
rfeldman Mon 8 Nov 2010
Nice! I will check this out tonight.
go4 Sat 27 Nov 2010
IMHO,Fantom can manage the dependency. Why do we need this?
rfeldman Sat 27 Nov 2010
If you already have an existing large Java maven project, this is a more feasible way to incorporate fantom than rewriting everything to be pod-based.
qualidafial Sat 27 Nov 2010
Also, as long as your dependencies are published to Maven central repository, sharing a project with dependencies is brutally simple: just clone the Maven-based Fantom project, and all your dependencies are fetched for you. It's also very handy when you evolve your dependencies to just change a version number in the pom, and presto, everybody else gets the new version automatically.
cheeser Sun 5 Dec 2010
I could really use this tonight. ;)
rajmahendra Thu 30 Dec 2010
@brian
Why not fanx.tools.Jstu be a switch with the fan command ?
something like
fan -jstub podName (creates a podName.jar)
fan -jstubx podName (creates exploded jstub)
Also i like a good interoperability with java. (java uses fan and fan uses java)
(Let me introduce myself i am Raj from India and new to Fan & Tales.)
cheeser Sun 6 Feb 2011
So no public repo for this yet? I can bootstrap my own plugin from some earlier stuff I've done but I'd rather collaborate if possible.